chore(deps): replace fast-glob with tinyglobby (#4132)

pull/4181/head
Cristopher 3 months ago committed by GitHub
parent ff1d030af1
commit cb1106d2ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -149,7 +149,6 @@
"debug": "^4.3.6", "debug": "^4.3.6",
"esbuild": "^0.23.1", "esbuild": "^0.23.1",
"execa": "^9.3.1", "execa": "^9.3.1",
"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.5",
"typescript": "^5.5.4", "typescript": "^5.5.4",
"vitest": "^2.0.5", "vitest": "^2.0.5",
"vue-tsc": "^2.1.4", "vue-tsc": "^2.1.4",

@ -164,9 +164,6 @@ importers:
execa: execa:
specifier: ^9.3.1 specifier: ^9.3.1
version: 9.3.1 version: 9.3.1
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.5
version: 0.2.5
typescript: typescript:
specifier: ^5.5.4 specifier: ^5.5.4
version: 5.5.4 version: 5.5.4
@ -1607,6 +1607,14 @@ packages:
fastq@1.17.1: fastq@1.17.1:
resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==}
fdir@6.3.0:
resolution: {integrity: sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==}
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'}
@ -2179,6 +2187,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'}
@ -2502,6 +2514,10 @@ packages:
tinybench@2.9.0: tinybench@2.9.0:
resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}
tinyglobby@0.2.5:
resolution: {integrity: sha512-Dlqgt6h0QkoHttG53/WGADNh9QhcjCAIZMTERAVhdpmIBEejSuLI9ZmGKWzB7tweBjlk30+s/ofi4SLmBeTYhw==}
engines: {node: '>=12.0.0'}
tinypool@1.0.1: tinypool@1.0.1:
resolution: {integrity: sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==} resolution: {integrity: sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==}
engines: {node: ^18.0.0 || >=20.0.0} engines: {node: ^18.0.0 || >=20.0.0}
@ -4037,6 +4053,10 @@ snapshots:
dependencies: dependencies:
reusify: 1.0.4 reusify: 1.0.4
fdir@6.3.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
@ -4581,6 +4601,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:
@ -4903,6 +4925,11 @@ snapshots:
tinybench@2.9.0: {} tinybench@2.9.0: {}
tinyglobby@0.2.5:
dependencies:
fdir: 6.3.0(picomatch@4.0.2)
picomatch: 4.0.2
tinypool@1.0.1: {} tinypool@1.0.1: {}
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 {
@ -118,6 +118,7 @@ export function createContentLoader<T = ContentData[]>(
files = ( files = (
await glob(pattern, { await glob(pattern, {
ignore: ['**/node_modules/**', '**/dist/**'], ignore: ['**/node_modules/**', '**/dist/**'],
expandDirectories: false,
...globOptions ...globOptions
}) })
).sort() ).sort()

@ -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!
@ -32,7 +32,8 @@ export async function resolvePages(
'**/node_modules/**', '**/node_modules/**',
'**/dist/**', '**/dist/**',
...(userConfig.srcExclude || []) ...(userConfig.srcExclude || [])
] ],
expandDirectories: false
}) })
).sort() ).sort()

@ -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,9 +98,11 @@ 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/**'],
expandDirectories: false
}) })
).sort() ).sort()
} }

Loading…
Cancel
Save