Skip to content

Commit 475861c

Browse files
committed
chore(deps): switch from fast-glob to tinyglobby
1 parent 1f9664d commit 475861c

File tree

10 files changed

+21
-22
lines changed

10 files changed

+21
-22
lines changed

package-lock.json

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/framework-info/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
"devDependencies": {
7373
"cpy": "^11.0.0",
7474
"cpy-cli": "^5.0.0",
75-
"fast-glob": "^3.2.12",
7675
"npm-run-all2": "^6.0.0",
7776
"rollup-plugin-node-polyfills": "^0.2.1",
7877
"tmp-promise": "^3.0.2",
78+
"tinyglobby": "^0.2.13",
7979
"typescript": "^5.0.0",
8080
"vite": "^6.0.0",
8181
"vitest": "^3.0.0"

packages/framework-info/tests/frameworks.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { fileURLToPath } from 'url'
22

33
import Ajv from 'ajv'
4-
import glob from 'fast-glob'
4+
import { glob } from 'tinyglobby'
55
import { describe, expect, test } from 'vitest'
66

77
import { FRAMEWORK_NAMES } from '../src/generated/frameworkNames.js'
@@ -139,7 +139,7 @@ test.each(FRAMEWORKS)('Framework $id should have a valid shape', (framework) =>
139139
})
140140

141141
describe('JSON files', async () => {
142-
const jsonFiles = await glob('*.json', { cwd: fileURLToPath(FRAMEWORKS_DIR) })
142+
const jsonFiles = await glob('*.json', { cwd: fileURLToPath(FRAMEWORKS_DIR), expandDirectories: false })
143143

144144
test('each json file should be required in main.ts FRAMEWORKS', async () => {
145145
expect(FRAMEWORKS).toHaveLength(jsonFiles.length)

packages/zip-it-and-ship-it/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"es-module-lexer": "^1.0.0",
5353
"esbuild": "0.25.4",
5454
"execa": "^8.0.0",
55-
"fast-glob": "^3.3.3",
5655
"filter-obj": "^6.0.0",
5756
"find-up": "^7.0.0",
5857
"is-builtin-module": "^3.1.0",
@@ -68,6 +67,7 @@
6867
"require-package-name": "^2.0.1",
6968
"resolve": "^2.0.0-next.1",
7069
"semver": "^7.3.8",
70+
"tinyglobby": "^0.2.13",
7171
"tmp-promise": "^3.0.2",
7272
"toml": "^3.0.0",
7373
"unixify": "^1.0.0",

packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/bundler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const includedFilesToEsbuildExternals = async (includedFiles: string[], baseDir:
6060

6161
if (hasMultipleGlobs) {
6262
const resolved = await glob(pattern, {
63-
globstar: false,
63+
// globstar: false,
6464
cwd: baseDir,
6565
})
6666

packages/zip-it-and-ship-it/src/runtimes/node/utils/included_files.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { normalize, resolve } from 'path'
22

3-
import glob from 'fast-glob'
3+
import { glob } from 'tinyglobby'
44

55
import { minimatch } from '../../../utils/matching.js'
66

@@ -54,12 +54,11 @@ export const getPathsOfIncludedFiles = async (
5454
dot: true,
5555
ignore: excludePatterns,
5656
onlyFiles: false,
57-
// get directories as well to get symlinked directories,
58-
// to filter the regular non symlinked directories out mark them with a slash at the end to filter them out.
59-
markDirectories: true,
6057
followSymbolicLinks: false,
58+
expandDirectories: false,
6159
})
6260

61+
// tinyglobby ends directories with `/`, so we can filter them out using that
6362
const paths = pathGroups.filter((path) => !path.endsWith('/')).map(normalize)
6463

6564
// now filter the non symlinked directories out that got marked with a trailing slash

packages/zip-it-and-ship-it/src/utils/matching.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import originalGlob from 'fast-glob'
21
import { minimatch as minimatchFunction, type MinimatchOptions } from 'minimatch'
32
import normalizePath from 'normalize-path'
3+
import { glob as originalGlob, GlobOptions } from 'tinyglobby'
44

55
/**
66
* Both glob and minimatch only support unix style slashes in patterns
77
* For this reason we wrap them and ensure all patterns are always unixified
88
* We use `normalize-path` here instead of `unixify` because we do not want to remove drive letters
99
*/
10-
export const glob = function (pattern: string, options: originalGlob.Options): Promise<string[]> {
11-
const normalizedIgnore = options.ignore?.map((expression) => normalizePath(expression))
12-
return originalGlob(normalizePath(pattern), { ...options, ignore: normalizedIgnore })
10+
export const glob = function (pattern: string, options: GlobOptions): Promise<string[]> {
11+
const ignore = Array.isArray(options.ignore) ? options.ignore : options.ignore ? [options.ignore] : []
12+
const normalizedIgnore = ignore.map((expression) => normalizePath(expression))
13+
return originalGlob(normalizePath(pattern), { ...options, ignore: normalizedIgnore, expandDirectories: false })
1314
}
1415

1516
export const minimatch = function (target: string, pattern: string, options?: MinimatchOptions): boolean {

packages/zip-it-and-ship-it/tests/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import cpy from 'cpy'
66
import decompress from 'decompress'
77
import merge from 'deepmerge'
88
import { execa, execaNode } from 'execa'
9-
import glob from 'fast-glob'
109
import isCI from 'is-ci'
1110
import { pathExists } from 'path-exists'
1211
import semver from 'semver'
12+
import { glob } from 'tinyglobby'
1313
import { dir as getTmpDir, tmpName } from 'tmp-promise'
1414
import unixify from 'unixify'
1515
import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from 'vitest'
@@ -2840,7 +2840,7 @@ describe('zip-it-and-ship-it', () => {
28402840

28412841
await decompress(files[0].path, unzipPath)
28422842

2843-
const fileNames: string[] = await glob('**', { dot: true, cwd: unzipPath })
2843+
const fileNames: string[] = await glob('**', { dot: true, cwd: unzipPath, expandDirectories: false })
28442844
const duplicates = fileNames.filter((item, index) => fileNames.indexOf(item) !== index)
28452845
expect(duplicates).toHaveLength(0)
28462846
})

packages/zip-it-and-ship-it/tests/telemetry.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { join } from 'path'
22

33
import decompress from 'decompress'
4-
import glob from 'fast-glob'
4+
import { glob } from 'tinyglobby'
55
import { dir as getTmpDir } from 'tmp-promise'
66
import { expect, test } from 'vitest'
77

@@ -32,7 +32,7 @@ test('The telemetry file should be added by default to the function bundle', asy
3232

3333
await decompress(result!.path, unzippedPath)
3434

35-
const files = await glob('**/*', { cwd: unzippedPath })
35+
const files = await glob('**/*', { cwd: unzippedPath, expandDirectories: false })
3636
expect(files.sort()).toEqual([
3737
'___netlify-bootstrap.mjs',
3838
'___netlify-entry-point.mjs',

packages/zip-it-and-ship-it/tests/v2api.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { platform } from 'process'
44

55
import { getPath as getBootstrapPath } from '@netlify/serverless-functions-api'
66
import merge from 'deepmerge'
7-
import glob from 'fast-glob'
87
import { pathExists } from 'path-exists'
8+
import { glob } from 'tinyglobby'
99
import { dir as getTmpDir } from 'tmp-promise'
1010
import { afterEach, describe, expect, test, vi } from 'vitest'
1111

@@ -128,7 +128,7 @@ describe('V2 functions API', () => {
128128

129129
const [{ name: archive, entryFilename, path }] = files
130130

131-
const untranspiledFiles = await glob(`${path}/**/*.ts`)
131+
const untranspiledFiles = await glob(`${path}/**/*.ts`, { expandDirectories: false })
132132
expect(untranspiledFiles).toEqual([])
133133

134134
const func = await importFunctionFile(`${tmpDir}/${archive}/${entryFilename}`)

0 commit comments

Comments
 (0)