Replace glob@^7.0.0 with tinyglobby@^0.2.15 (#54737)

Summary:
This replaces `glob@^7.0.0` with `tinyglobby@^0.2.15`. `glob@7` has been deprecated for a while and some versions after had security notices released for them. The plan is to backport this PR to `0.81.x` and onwards.

> [!NOTE]
> This is a stopgap solution until `fs.glob` becomes generally available with the EOL of Node v20

Succeeds:
- https://github.com/facebook/react-native/issues/54669
- https://github.com/facebook/react-native/issues/48875

## Changelog:

[GENERAL] [SECURITY] - Replace `glob@^7.0.0` with `tinyglobby@^0.2.15`

Pull Request resolved: https://github.com/facebook/react-native/pull/54737

Test Plan:
- Ran all modified commands manually and `pod install in `rn-tester`
- NOTE: `ios-prebuild`-related scripts haven't been run manually yet

Reviewed By: robhogan

Differential Revision: D88069145

Pulled By: huntie

fbshipit-source-id: 0c455342a4c6d1d6605fd09fe47b418e5d751491
This commit is contained in:
Phil Pluckthun authored and meta-codesync[bot] committed 2025-12-03 05:45:48 -08:00
1 parent b447d267a8
commit 41eace0093
17 files changed
+159 -160

No files matched your search

@@ -15,8 +15,8 @@ const {FlowParser} = require('../../parsers/flow/parser');
const {TypeScriptParser} = require('../../parsers/typescript/parser');
const {filterJSFile} = require('./combine-utils');
const fs = require('fs');
const glob = require('glob');
const path = require('path');
const {globSync} = require('tinyglobby');
const flowParser = new FlowParser();
const typescriptParser = new TypeScriptParser();
@@ -66,13 +66,11 @@ function expandDirectoriesIntoFiles(
if (!fs.lstatSync(file).isDirectory()) {
return [file];
}
const filePattern = path.sep === '\\' ? file.replace(/\\/g, '/') : file;
return glob.sync(`${filePattern}/**/*{,.fb}.{js,ts,tsx}`, {
nodir: true,
// TODO: This will remove the need of slash substitution above for Windows,
// but it requires glob@v9+; with the package currenlty relying on
// glob@7.1.1; and flow-typed repo not having definitions for glob@9+.
// windowsPathsNoEscape: true,
return globSync('**/*{,.fb}.{js,ts,tsx}', {
expandDirectories: false,
onlyFiles: true,
absolute: true,
cwd: file,
});
})
.filter(element => filterJSFile(element, platform, exclude));