chore(deps): replace fast-glob with tinyglobby

pull/4132/head
Cristopher 1 year ago
parent 3c40e9d9a8
commit 53d4271c17
No known key found for this signature in database
GPG Key ID: E31DBC7E9AEE527C

@ -149,7 +149,6 @@
"debug": "^4.3.5", "debug": "^4.3.5",
"esbuild": "^0.23.0", "esbuild": "^0.23.0",
"execa": "^9.3.0", "execa": "^9.3.0",
"fast-glob": "^3.3.2",
"fs-extra": "^11.2.0", "fs-extra": "^11.2.0",
"get-port": "^7.1.0", "get-port": "^7.1.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
@ -185,6 +184,7 @@
"sirv": "^2.0.4", "sirv": "^2.0.4",
"sitemap": "^8.0.0", "sitemap": "^8.0.0",
"supports-color": "^9.4.0", "supports-color": "^9.4.0",
"tinyglobby": "^0.2.2",
"typescript": "^5.5.3", "typescript": "^5.5.3",
"vitest": "^2.0.2", "vitest": "^2.0.2",
"vue-tsc": "^2.0.29", "vue-tsc": "^2.0.29",

@ -164,9 +164,6 @@ importers:
execa: execa:
specifier: ^9.3.0 specifier: ^9.3.0
version: 9.3.0 version: 9.3.0
fast-glob:
specifier: ^3.3.2
version: 3.3.2
fs-extra: fs-extra:
specifier: ^11.2.0 specifier: ^11.2.0
version: 11.2.0 version: 11.2.0
@ -272,6 +269,9 @@ importers:
supports-color: supports-color:
specifier: ^9.4.0 specifier: ^9.4.0
version: 9.4.0 version: 9.4.0
tinyglobby:
specifier: ^0.2.2
version: 0.2.2
typescript: typescript:
specifier: ^5.5.3 specifier: ^5.5.3
version: 5.5.3 version: 5.5.3
@ -1603,6 +1603,14 @@ packages:
fastq@1.17.1: fastq@1.17.1:
resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==}
fdir@6.2.0:
resolution: {integrity: sha512-9XaWcDl0riOX5j2kYfy0kKdg7skw3IY6kA4LFT8Tk2yF9UdrADUy8D6AJuBLtf7ISm/MksumwAHE3WVbMRyCLw==}
peerDependencies:
picomatch: ^3 || ^4
peerDependenciesMeta:
picomatch:
optional: true
figures@6.1.0: figures@6.1.0:
resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==}
engines: {node: '>=18'} engines: {node: '>=18'}
@ -2175,6 +2183,10 @@ packages:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'} engines: {node: '>=8.6'}
picomatch@4.0.2:
resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
engines: {node: '>=12'}
pidtree@0.6.0: pidtree@0.6.0:
resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==}
engines: {node: '>=0.10'} engines: {node: '>=0.10'}
@ -2501,6 +2513,10 @@ packages:
tinybench@2.8.0: tinybench@2.8.0:
resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==}
tinyglobby@0.2.2:
resolution: {integrity: sha512-mZ2sDMaySvi1PkTp4lTo1In2zjU+cY8OvZsfwrDrx3YGRbXPX1/cbPwCR9zkm3O/Fz9Jo0F1HNgIQ1b8BepqyQ==}
engines: {node: '>=12.0.0'}
tinypool@1.0.0: tinypool@1.0.0:
resolution: {integrity: sha512-KIKExllK7jp3uvrNtvRBYBWBOAXSX8ZvoaD8T+7KB/QHIuoJW3Pmr60zucywjAlMb5TeXUkcs/MWeWLu0qvuAQ==} resolution: {integrity: sha512-KIKExllK7jp3uvrNtvRBYBWBOAXSX8ZvoaD8T+7KB/QHIuoJW3Pmr60zucywjAlMb5TeXUkcs/MWeWLu0qvuAQ==}
engines: {node: ^18.0.0 || >=20.0.0} engines: {node: ^18.0.0 || >=20.0.0}
@ -4029,6 +4045,10 @@ snapshots:
dependencies: dependencies:
reusify: 1.0.4 reusify: 1.0.4
fdir@6.2.0(picomatch@4.0.2):
optionalDependencies:
picomatch: 4.0.2
figures@6.1.0: figures@6.1.0:
dependencies: dependencies:
is-unicode-supported: 2.0.0 is-unicode-supported: 2.0.0
@ -4573,6 +4593,8 @@ snapshots:
picomatch@2.3.1: {} picomatch@2.3.1: {}
picomatch@4.0.2: {}
pidtree@0.6.0: {} pidtree@0.6.0: {}
pkg-dir@8.0.0: pkg-dir@8.0.0:
@ -4897,6 +4919,11 @@ snapshots:
tinybench@2.8.0: {} tinybench@2.8.0: {}
tinyglobby@0.2.2:
dependencies:
fdir: 6.2.0(picomatch@4.0.2)
picomatch: 4.0.2
tinypool@1.0.0: {} tinypool@1.0.0: {}
tinyrainbow@1.2.0: {} tinyrainbow@1.2.0: {}

@ -1,11 +1,11 @@
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import fg from 'fast-glob' import { globSync } from 'tinyglobby'
function toDest(file) { function toDest(file) {
return file.replace(/^src\//, 'dist/') return file.replace(/^src\//, 'dist/')
} }
fg.sync('src/client/**').forEach((file) => { globSync(['src/client/**']).forEach((file) => {
if (/(\.ts|tsconfig\.json)$/.test(file)) return if (/(\.ts|tsconfig\.json)$/.test(file)) return
copy(file, toDest(file)) copy(file, toDest(file))
}) })

@ -1,7 +1,7 @@
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import fg from 'fast-glob' import { globSync } from 'tinyglobby'
fg.sync('src/shared/**/*.ts').forEach(async (file) => { globSync(['src/shared/**/*.ts']).forEach(async (file) => {
await Promise.all([ await Promise.all([
copy(file, file.replace(/^src\/shared\//, 'src/node/')), copy(file, file.replace(/^src\/shared\//, 'src/node/')),
copy(file, file.replace(/^src\/shared\//, 'src/client/')) copy(file, file.replace(/^src\/shared\//, 'src/client/'))

@ -1,6 +1,6 @@
import fs from 'fs-extra' import fs from 'fs-extra'
import path from 'path' import path from 'path'
import glob from 'fast-glob' import { glob, type GlobOptions } from 'tinyglobby'
import type { SiteConfig } from './config' import type { SiteConfig } from './config'
import matter from 'gray-matter' import matter from 'gray-matter'
import { normalizePath } from 'vite' import { normalizePath } from 'vite'
@ -54,11 +54,11 @@ export interface ContentOptions<T = ContentData[]> {
transform?: (data: ContentData[]) => T | Promise<T> transform?: (data: ContentData[]) => T | Promise<T>
/** /**
* Options to pass to `fast-glob`. * Options to pass to `tinyglobby`.
* You'll need to manually specify `node_modules` and `dist` in * You'll need to manually specify `node_modules` and `dist` in
* `globOptions.ignore` if you've overridden it. * `globOptions.ignore` if you've overridden it.
*/ */
globOptions?: glob.Options globOptions?: GlobOptions
} }
export interface ContentData { export interface ContentData {

@ -8,7 +8,7 @@ import {
import fs from 'fs-extra' import fs from 'fs-extra'
import c from 'picocolors' import c from 'picocolors'
import path from 'path' import path from 'path'
import glob from 'fast-glob' import { glob } from 'tinyglobby'
import { type SiteConfig, type UserConfig } from '../siteConfig' import { type SiteConfig, type UserConfig } from '../siteConfig'
import { resolveRewrites } from './rewritesPlugin' import { resolveRewrites } from './rewritesPlugin'
@ -19,7 +19,7 @@ export async function resolvePages(
userConfig: UserConfig, userConfig: UserConfig,
logger: Logger logger: Logger
) { ) {
// Important: fast-glob doesn't guarantee order of the returned files. // Important: tinyglobby doesn't guarantee order of the returned files.
// We must sort the pages so the input list to rollup is stable across // We must sort the pages so the input list to rollup is stable across
// builds - otherwise different input order could result in different exports // builds - otherwise different input order could result in different exports
// order in shared chunks which in turns invalidates the hash of every chunk! // order in shared chunks which in turns invalidates the hash of every chunk!

@ -6,7 +6,7 @@ import {
} from 'vite' } from 'vite'
import path, { dirname, resolve } from 'path' import path, { dirname, resolve } from 'path'
import { isMatch } from 'micromatch' import { isMatch } from 'micromatch'
import glob from 'fast-glob' import { glob } from 'tinyglobby'
const loaderMatch = /\.data\.m?(j|t)s($|\?)/ const loaderMatch = /\.data\.m?(j|t)s($|\?)/
@ -98,6 +98,7 @@ export const staticDataPlugin: Plugin = {
// load the data // load the data
let watchedFiles let watchedFiles
if (watch) { if (watch) {
if (typeof watch === 'string') watch = [watch]
watchedFiles = ( watchedFiles = (
await glob(watch, { await glob(watch, {
ignore: ['**/node_modules/**', '**/dist/**'] ignore: ['**/node_modules/**', '**/dist/**']

Loading…
Cancel
Save