Skip to content

Commit 8c21c94

Browse files
committed
refactor: switch to tinyglobby
1 parent cb66124 commit 8c21c94

File tree

16 files changed

+83
-43
lines changed

16 files changed

+83
-43
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"eslint-plugin-ft-flow": "^2.0.1",
4242
"eslint-plugin-import": "^2.25.3",
4343
"execa": "^5.0.0",
44-
"fast-glob": "^3.3.2",
4544
"husky": "^8.0.2",
4645
"jest": "^26.6.2",
4746
"jest-circus": "^26.6.2",
@@ -53,6 +52,7 @@
5352
"prettier": "2.8.8",
5453
"slash": "^3.0.0",
5554
"string-length": "^2.0.0",
55+
"tinyglobby": "^0.2.14",
5656
"typescript": "^5.2.0"
5757
},
5858
"resolutions": {

packages/cli-clean/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@react-native-community/cli-tools": "19.0.0",
1212
"chalk": "^4.1.2",
1313
"execa": "^5.0.0",
14-
"fast-glob": "^3.3.2"
14+
"tinyglobby": "^0.2.14"
1515
},
1616
"files": [
1717
"build",

packages/cli-clean/src/clean.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {existsSync as fileExists, rm} from 'fs';
66
import os from 'os';
77
import path from 'path';
88
import {promisify} from 'util';
9-
import glob from 'fast-glob';
9+
import glob from 'tinyglobby';
1010

1111
type Args = {
1212
include?: string;
@@ -38,7 +38,10 @@ function isDirectoryPattern(directory: string): boolean {
3838
export async function cleanDir(directory: string): Promise<void> {
3939
try {
4040
if (isDirectoryPattern(directory)) {
41-
const directories = await glob.async(directory, {onlyFiles: false});
41+
const directories = await glob.glob(directory, {
42+
onlyFiles: false,
43+
expandDirectories: false,
44+
});
4245

4346
for (const dir of directories) {
4447
await rmAsync(dir, rmAsyncOptions);

packages/cli-config-android/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"dependencies": {
1010
"@react-native-community/cli-tools": "19.0.0",
1111
"chalk": "^4.1.2",
12-
"fast-glob": "^3.3.2",
13-
"fast-xml-parser": "^4.4.1"
12+
"fast-xml-parser": "^4.4.1",
13+
"tinyglobby": "^0.2.14"
1414
},
1515
"files": [
1616
"build",

packages/cli-config-android/src/config/findComponentDescriptors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import glob from 'fast-glob';
3+
import glob from 'tinyglobby';
44
import {extractComponentDescriptors} from './extractComponentDescriptors';
55
import {unixifyPaths} from '@react-native-community/cli-tools';
66

@@ -18,9 +18,9 @@ export function findComponentDescriptors(packageRoot: string) {
1818
const globPattern = jsSrcsDir
1919
? `${jsSrcsDir}/**/+(*.js|*.jsx|*.ts|*.tsx)`
2020
: '**/+(*.js|*.jsx|*.ts|*.tsx)';
21-
const files = glob.sync(globPattern, {
21+
const files = glob.globSync(globPattern, {
2222
cwd: unixifyPaths(packageRoot),
23-
onlyFiles: true,
23+
expandDirectories: false,
2424
ignore: ['**/node_modules/**'],
2525
});
2626
const codegenComponent = files

packages/cli-config-android/src/config/findManifest.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
*
77
*/
88

9-
import glob from 'fast-glob';
9+
import glob from 'tinyglobby';
1010
import path from 'path';
1111
import {unixifyPaths} from '@react-native-community/cli-tools';
1212

1313
export default function findManifest(folder: string) {
14-
let manifestPaths = glob.sync('**/AndroidManifest.xml', {
14+
let manifestPaths = glob.globSync('**/AndroidManifest.xml', {
1515
cwd: unixifyPaths(folder),
16+
expandDirectories: false,
1617
ignore: [
1718
'**/build/**',
1819
'**/debug/**',

packages/cli-config-android/src/config/findPackageClassName.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import fs from 'fs';
10-
import glob from 'fast-glob';
10+
import glob from 'tinyglobby';
1111
import path from 'path';
1212
import {unixifyPaths} from '@react-native-community/cli-tools';
1313

@@ -23,9 +23,9 @@ export function getMainActivityFiles(
2323
patternArray.push('*.java', '*.kt');
2424
}
2525

26-
return glob.sync(`**/+(${patternArray.join('|')})`, {
26+
return glob.globSync(`**/+(${patternArray.join('|')})`, {
2727
cwd: unixifyPaths(folder),
28-
onlyFiles: true,
28+
expandDirectories: false,
2929
ignore: ['**/.cxx/**'],
3030
});
3131
}

packages/cli-config-apple/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@react-native-community/cli-tools": "19.0.0",
1111
"chalk": "^4.1.2",
1212
"execa": "^5.0.0",
13-
"fast-glob": "^3.3.2"
13+
"tinyglobby": "^0.2.14"
1414
},
1515
"devDependencies": {
1616
"@react-native-community/cli-types": "19.0.0",

packages/cli-config-apple/src/config/findAllPodfilePaths.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
*/
8-
import glob from 'fast-glob';
8+
import glob from 'tinyglobby';
99
import {unixifyPaths} from '@react-native-community/cli-tools';
1010

1111
// These folders will be excluded from search to speed it up
@@ -14,8 +14,9 @@ const GLOB_EXCLUDE_PATTERN = [
1414
];
1515

1616
export default function findAllPodfilePaths(cwd: string) {
17-
return glob.sync('**/Podfile', {
17+
return glob.globSync('**/Podfile', {
1818
cwd: unixifyPaths(cwd),
19+
expandDirectories: false,
1920
ignore: GLOB_EXCLUDE_PATTERN,
2021
// Stop unbounded globbing and infinite loops for projects
2122
// with deeply nested subdirectories. The most likely result

packages/cli-config-apple/src/config/findPodspec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import glob from 'fast-glob';
1+
import glob from 'tinyglobby';
22
import path from 'path';
33
import {unixifyPaths} from '@react-native-community/cli-tools';
44

55
export default function findPodspec(folder: string): string | null {
6-
const podspecs = glob.sync('*.podspec', {cwd: unixifyPaths(folder)});
6+
const podspecs = glob.globSync('*.podspec', {
7+
cwd: unixifyPaths(folder),
8+
expandDirectories: false,
9+
});
710

811
if (podspecs.length === 0) {
912
return null;

packages/cli-config/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"chalk": "^4.1.2",
1313
"cosmiconfig": "^9.0.0",
1414
"deepmerge": "^4.3.0",
15-
"fast-glob": "^3.3.2",
1615
"joi": "^17.2.1"
1716
},
1817
"files": [

packages/cli-link-assets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"@react-native-community/cli-platform-ios": "19.0.0",
1515
"@react-native-community/cli-tools": "19.0.0",
1616
"chalk": "^4.1.2",
17-
"fast-glob": "^3.3.2",
1817
"fast-xml-parser": "^4.4.1",
1918
"opentype.js": "^1.3.4",
2019
"plist": "^3.1.0",
20+
"tinyglobby": "^0.2.14",
2121
"xcode": "^3.0.1"
2222
},
2323
"files": [

packages/cli-link-assets/src/tools/helpers/font/androidFontAssetHelpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {isProjectUsingKotlin} from '@react-native-community/cli-platform-android
22
import {CLIError, logger} from '@react-native-community/cli-tools';
33
import {XMLBuilder, XMLParser} from 'fast-xml-parser';
44
import fs from 'fs-extra';
5-
import glob from 'fast-glob';
5+
import glob from 'tinyglobby';
66
import OpenType from 'opentype.js';
77
import path from 'path';
88

@@ -77,8 +77,9 @@ function convertToAndroidResourceName(str: string) {
7777
function getProjectFilePath(rootPath: string, name: string) {
7878
const isUsingKotlin = isProjectUsingKotlin(rootPath);
7979
const ext = isUsingKotlin ? 'kt' : 'java';
80-
const filePath = glob.sync(
80+
const filePath = glob.globSync(
8181
path.join(rootPath, `app/src/main/java/**/${name}.${ext}`),
82+
{expandDirectories: false},
8283
)[0];
8384
return filePath;
8485
}

scripts/build.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
const fs = require('fs');
2222
const path = require('path');
23-
const glob = require('fast-glob');
23+
const glob = require('tinyglobby');
2424
const babel = require('@babel/core');
2525
const chalk = require('chalk');
2626
const micromatch = require('micromatch');
@@ -55,9 +55,7 @@ function getBuildPath(file, buildFolder) {
5555
function buildNodePackage(p) {
5656
const srcDir = path.resolve(p, SRC_DIR);
5757
const pattern = path.resolve(srcDir, '**/*');
58-
const files = glob.sync(pattern, {
59-
nodir: true,
60-
});
58+
const files = glob.globSync(pattern, {expandDirectories: false});
6159

6260
process.stdout.write(adjustToTerminalWidth(`${path.basename(p)}\n`));
6361

scripts/linkPackages.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
const execa = require('execa');
22
const chalk = require('chalk');
33
const path = require('path');
4-
const glob = require('fast-glob');
4+
const glob = require('tinyglobby');
55

6-
const projects = glob.sync('packages/*/package.json');
6+
const projects = glob.globSync('packages/*/package.json', {
7+
expandDirectories: false,
8+
});
79

810
projects.forEach((project) => {
911
const cwd = path.dirname(project);

yarn.lock

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4769,17 +4769,6 @@ fast-glob@^3.2.9, fast-glob@^3.3.1:
47694769
merge2 "^1.3.0"
47704770
micromatch "^4.0.4"
47714771

4772-
fast-glob@^3.3.2:
4773-
version "3.3.2"
4774-
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129"
4775-
integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==
4776-
dependencies:
4777-
"@nodelib/fs.stat" "^2.0.2"
4778-
"@nodelib/fs.walk" "^1.2.3"
4779-
glob-parent "^5.1.2"
4780-
merge2 "^1.3.0"
4781-
micromatch "^4.0.4"
4782-
47834772
fast-json-stable-stringify@^2.0.0:
47844773
version "2.1.0"
47854774
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
@@ -4811,6 +4800,11 @@ fb-watchman@^2.0.0:
48114800
dependencies:
48124801
bser "2.1.1"
48134802

4803+
fdir@^6.4.4:
4804+
version "6.4.6"
4805+
resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.6.tgz#2b268c0232697063111bbf3f64810a2a741ba281"
4806+
integrity sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==
4807+
48144808
[email protected], figures@^3.0.0:
48154809
version "3.2.0"
48164810
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
@@ -8507,6 +8501,11 @@ picomatch@^2.0.4, picomatch@^2.0.7, picomatch@^2.3.1:
85078501
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
85088502
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
85098503

8504+
picomatch@^4.0.2:
8505+
version "4.0.2"
8506+
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab"
8507+
integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==
8508+
85108509
pidtree@^0.6.0:
85118510
version "0.6.0"
85128511
resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c"
@@ -9701,7 +9700,16 @@ string-natural-compare@^3.0.1:
97019700
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
97029701
integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==
97039702

9704-
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
9703+
"string-width-cjs@npm:string-width@^4.2.0":
9704+
version "4.2.3"
9705+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
9706+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
9707+
dependencies:
9708+
emoji-regex "^8.0.0"
9709+
is-fullwidth-code-point "^3.0.0"
9710+
strip-ansi "^6.0.1"
9711+
9712+
"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
97059713
version "4.2.3"
97069714
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
97079715
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -9796,7 +9804,7 @@ string_decoder@~1.1.1:
97969804
dependencies:
97979805
safe-buffer "~5.1.0"
97989806

9799-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
9807+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
98009808
version "6.0.1"
98019809
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
98029810
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -9817,6 +9825,13 @@ strip-ansi@^5.0.0:
98179825
dependencies:
98189826
ansi-regex "^4.1.0"
98199827

9828+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
9829+
version "6.0.1"
9830+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
9831+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
9832+
dependencies:
9833+
ansi-regex "^5.0.1"
9834+
98209835
strip-ansi@^7.0.1:
98219836
version "7.0.1"
98229837
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2"
@@ -10009,6 +10024,14 @@ tiny-inflate@^1.0.3:
1000910024
resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.3.tgz#122715494913a1805166aaf7c93467933eea26c4"
1001010025
integrity sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==
1001110026

10027+
tinyglobby@^0.2.14:
10028+
version "0.2.14"
10029+
resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.14.tgz#5280b0cf3f972b050e74ae88406c0a6a58f4079d"
10030+
integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==
10031+
dependencies:
10032+
fdir "^6.4.4"
10033+
picomatch "^4.0.2"
10034+
1001210035
tmp@^0.0.33:
1001310036
version "0.0.33"
1001410037
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
@@ -10665,7 +10688,7 @@ wordwrap@^1.0.0:
1066510688
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
1066610689
integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=
1066710690

10668-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
10691+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
1066910692
version "7.0.0"
1067010693
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1067110694
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -10683,6 +10706,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
1068310706
string-width "^4.1.0"
1068410707
strip-ansi "^6.0.0"
1068510708

10709+
wrap-ansi@^7.0.0:
10710+
version "7.0.0"
10711+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
10712+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
10713+
dependencies:
10714+
ansi-styles "^4.0.0"
10715+
string-width "^4.1.0"
10716+
strip-ansi "^6.0.0"
10717+
1068610718
wrap-ansi@^8.1.0:
1068710719
version "8.1.0"
1068810720
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)