Skip to content

Commit cb1106d

Browse files
authored
chore(deps): replace fast-glob with tinyglobby (vuejs#4132)
1 parent ff1d030 commit cb1106d

7 files changed

+47
-16
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
"debug": "^4.3.6",
150150
"esbuild": "^0.23.1",
151151
"execa": "^9.3.1",
152-
"fast-glob": "^3.3.2",
153152
"fs-extra": "^11.2.0",
154153
"get-port": "^7.1.0",
155154
"gray-matter": "^4.0.3",
@@ -185,6 +184,7 @@
185184
"sirv": "^2.0.4",
186185
"sitemap": "^8.0.0",
187186
"supports-color": "^9.4.0",
187+
"tinyglobby": "^0.2.5",
188188
"typescript": "^5.5.4",
189189
"vitest": "^2.0.5",
190190
"vue-tsc": "^2.1.4",

pnpm-lock.yaml

+30-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/copyClient.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { copy } from 'fs-extra'
2-
import fg from 'fast-glob'
2+
import { globSync } from 'tinyglobby'
33

44
function toDest(file) {
55
return file.replace(/^src\//, 'dist/')
66
}
77

8-
fg.sync('src/client/**').forEach((file) => {
8+
globSync(['src/client/**']).forEach((file) => {
99
if (/(\.ts|tsconfig\.json)$/.test(file)) return
1010
copy(file, toDest(file))
1111
})

scripts/copyShared.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { copy } from 'fs-extra'
2-
import fg from 'fast-glob'
2+
import { globSync } from 'tinyglobby'
33

4-
fg.sync('src/shared/**/*.ts').forEach(async (file) => {
4+
globSync(['src/shared/**/*.ts']).forEach(async (file) => {
55
await Promise.all([
66
copy(file, file.replace(/^src\/shared\//, 'src/node/')),
77
copy(file, file.replace(/^src\/shared\//, 'src/client/'))

src/node/contentLoader.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'fs-extra'
22
import path from 'path'
3-
import glob from 'fast-glob'
3+
import { glob, type GlobOptions } from 'tinyglobby'
44
import type { SiteConfig } from './config'
55
import matter from 'gray-matter'
66
import { normalizePath } from 'vite'
@@ -54,11 +54,11 @@ export interface ContentOptions<T = ContentData[]> {
5454
transform?: (data: ContentData[]) => T | Promise<T>
5555

5656
/**
57-
* Options to pass to `fast-glob`.
57+
* Options to pass to `tinyglobby`.
5858
* You'll need to manually specify `node_modules` and `dist` in
5959
* `globOptions.ignore` if you've overridden it.
6060
*/
61-
globOptions?: glob.Options
61+
globOptions?: GlobOptions
6262
}
6363

6464
export interface ContentData {
@@ -118,6 +118,7 @@ export function createContentLoader<T = ContentData[]>(
118118
files = (
119119
await glob(pattern, {
120120
ignore: ['**/node_modules/**', '**/dist/**'],
121+
expandDirectories: false,
121122
...globOptions
122123
})
123124
).sort()

src/node/plugins/dynamicRoutesPlugin.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import fs from 'fs-extra'
99
import c from 'picocolors'
1010
import path from 'path'
11-
import glob from 'fast-glob'
11+
import { glob } from 'tinyglobby'
1212
import { type SiteConfig, type UserConfig } from '../siteConfig'
1313
import { resolveRewrites } from './rewritesPlugin'
1414

@@ -19,7 +19,7 @@ export async function resolvePages(
1919
userConfig: UserConfig,
2020
logger: Logger
2121
) {
22-
// Important: fast-glob doesn't guarantee order of the returned files.
22+
// Important: tinyglobby doesn't guarantee order of the returned files.
2323
// We must sort the pages so the input list to rollup is stable across
2424
// builds - otherwise different input order could result in different exports
2525
// order in shared chunks which in turns invalidates the hash of every chunk!
@@ -32,7 +32,8 @@ export async function resolvePages(
3232
'**/node_modules/**',
3333
'**/dist/**',
3434
...(userConfig.srcExclude || [])
35-
]
35+
],
36+
expandDirectories: false
3637
})
3738
).sort()
3839

src/node/plugins/staticDataPlugin.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from 'vite'
77
import path, { dirname, resolve } from 'path'
88
import { isMatch } from 'micromatch'
9-
import glob from 'fast-glob'
9+
import { glob } from 'tinyglobby'
1010

1111
const loaderMatch = /\.data\.m?(j|t)s($|\?)/
1212

@@ -98,9 +98,11 @@ export const staticDataPlugin: Plugin = {
9898
// load the data
9999
let watchedFiles
100100
if (watch) {
101+
if (typeof watch === 'string') watch = [watch]
101102
watchedFiles = (
102103
await glob(watch, {
103-
ignore: ['**/node_modules/**', '**/dist/**']
104+
ignore: ['**/node_modules/**', '**/dist/**'],
105+
expandDirectories: false
104106
})
105107
).sort()
106108
}

0 commit comments

Comments
 (0)