Skip to content

Commit 11f9b2d

Browse files
jaysooFrozenPandaz
authored andcommitted
fix(js): update tinyglobby to speed up shallow file matching (#30415)
`tinyglobby` at `0.2.10` (what we use now) is slow on shallow files, but the latest version `0.2.12` is fast due to this PR https://github.com/SuperchupuDev/tinyglobby/pull/69/files. This PR updates both the js and esbuild plugins to use the newest versions, but also adds `tinyglobby@^0.2.12` to our root `package.json` so we get the speed increase right away. I removed `fast-glob` in our repo scripts and replaced it with `tinyglobby`. Asset handling is slow for shallow files like `LICENSE` but is fine for scoped patterns like `src/**/*.ts`. Asset handling should be fast for shallow files. <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # (cherry picked from commit e0cae53)
1 parent e1e3541 commit 11f9b2d

File tree

7 files changed

+26
-29
lines changed

7 files changed

+26
-29
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@
354354
"cliui": "^8.0.1",
355355
"core-js": "3.36.1",
356356
"enquirer": "~2.3.6",
357-
"fast-glob": "3.2.7",
358357
"framer-motion": "^11.3.0",
359358
"front-matter": "^4.0.2",
360359
"glob": "7.1.4",
@@ -377,6 +376,7 @@
377376
"tailwind-merge": "^2.4.0",
378377
"tailwindcss": "3.4.4",
379378
"three": "^0.166.1",
379+
"tinyglobby": "^0.2.12",
380380
"tslib": "^2.3.0",
381381
"webpack-cli": "^5.1.4"
382382
},

packages/esbuild/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"dependencies": {
3434
"@nx/devkit": "file:../devkit",
3535
"@nx/js": "file:../js",
36-
"tinyglobby": "^0.2.10",
36+
"tinyglobby": "^0.2.12",
3737
"picocolors": "^1.1.0",
3838
"tsconfig-paths": "^4.1.2",
3939
"tslib": "^2.3.0"

packages/js/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"picomatch": "4.0.2",
6060
"semver": "^7.5.3",
6161
"source-map-support": "0.5.19",
62-
"tinyglobby": "^0.2.10",
62+
"tinyglobby": "^0.2.12",
6363
"ts-node": "10.9.1",
6464
"tsconfig-paths": "^4.1.2",
6565
"tslib": "^2.3.0"

pnpm-lock.yaml

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

scripts/check-codeowners.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as fg from 'fast-glob';
1+
import * as globby from 'tinyglobby';
22
import * as path from 'path';
33
import * as fs from 'fs';
44
import * as octokit from 'octokit';
@@ -35,7 +35,7 @@ async function main() {
3535

3636
for (const pattern of patternsToCheck) {
3737
foundMatchingFiles ||=
38-
fg.sync(pattern, {
38+
globby.globSync(pattern, {
3939
ignore: ['node_modules', 'dist', 'build', '.git'],
4040
cwd: path.join(__dirname, '..'),
4141
onlyFiles: false,

scripts/copy-local-native.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//@ts-check
22
const fs = require('fs');
3-
const glob = require('fast-glob');
3+
const glob = require('tinyglobby');
44

55
const p = process.argv[2];
66

7-
const nativeFiles = glob.sync(`packages/${p}/**/*.{node,wasm,js,mjs,cjs}`);
7+
const nativeFiles = glob.globSync(`packages/${p}/**/*.{node,wasm,js,mjs,cjs}`);
88

99
console.log({ nativeFiles });
1010

scripts/copy.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ts-check
22
const { mkdirSync, copySync } = require('fs-extra');
3-
const glob = require('fast-glob');
3+
const glob = require('tinyglobby');
44
const { join, basename } = require('path');
55

66
const p = process.argv[2];
@@ -15,7 +15,7 @@ try {
1515
});
1616
} catch {}
1717
for (const f of from) {
18-
const matchingFiles = glob.sync(f, {
18+
const matchingFiles = glob.globSync(f, {
1919
cwd: process.cwd(),
2020
onlyDirectories: true,
2121
});

0 commit comments

Comments
 (0)