Skip to content

Commit e0cae53

Browse files
authored
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`. ## Current Behavior Asset handling is slow for shallow files like `LICENSE` but is fine for scoped patterns like `src/**/*.ts`. ## Expected Behavior Asset handling should be fast for shallow files. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
1 parent 851138c commit e0cae53

File tree

7 files changed

+233
-236
lines changed

7 files changed

+233
-236
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@
355355
"cliui": "^8.0.1",
356356
"core-js": "3.36.1",
357357
"enquirer": "~2.3.6",
358-
"fast-glob": "3.2.7",
359358
"framer-motion": "^11.3.0",
360359
"front-matter": "^4.0.2",
361360
"glob": "7.1.4",
@@ -378,6 +377,7 @@
378377
"tailwind-merge": "^2.4.0",
379378
"tailwindcss": "3.4.4",
380379
"three": "^0.166.1",
380+
"tinyglobby": "^0.2.12",
381381
"tslib": "^2.3.0",
382382
"webpack-cli": "^5.1.4"
383383
},

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

+224-227
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)