mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
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:
1 parent
b447d267a8
commit
41eace0093
17 files changed
+159
-160
No files matched your search
@@ -23,11 +23,11 @@ const {
|
||||
// $FlowFixMe[cannot-resolve-module]
|
||||
} = require('@microsoft/api-extractor');
|
||||
const {promises: fs} = require('fs');
|
||||
const glob = require('glob');
|
||||
const {diff} = require('jest-diff');
|
||||
const path = require('path');
|
||||
const prettier = require('prettier');
|
||||
const osTempDir = require('temp-dir');
|
||||
const {globSync} = require('tinyglobby');
|
||||
const {styleText} = require('util');
|
||||
|
||||
const inputFilesPostTransforms: $ReadOnlyArray<PluginObj<mixed>> = [
|
||||
@@ -163,12 +163,11 @@ async function validateSnapshots(
|
||||
}
|
||||
|
||||
async function findPackagesWithTypedef() {
|
||||
const packagesWithGeneratedTypes = glob
|
||||
.sync(`${PACKAGES_DIR}/**/types_generated`, {nodir: false})
|
||||
.map(typesPath =>
|
||||
path.relative(PACKAGES_DIR, typesPath).split('/').slice(0, -1).join('/'),
|
||||
);
|
||||
|
||||
const packagesWithGeneratedTypes = globSync('**/types_generated', {
|
||||
cwd: PACKAGES_DIR,
|
||||
onlyDirectories: true,
|
||||
expandDirectories: false,
|
||||
}).map(typesPath => path.dirname(typesPath));
|
||||
const packagesWithNames = await Promise.all(
|
||||
packagesWithGeneratedTypes.map(async pkg => {
|
||||
const packageJsonContent = await fs.readFile(
|
||||
@@ -202,7 +201,11 @@ async function preparePackagesInTempDir(
|
||||
}),
|
||||
);
|
||||
|
||||
const typeDefs = glob.sync(`${tempDirectory}/**/*.d.ts`);
|
||||
const typeDefs = globSync('**/*.d.ts', {
|
||||
cwd: tempDirectory,
|
||||
onlyFiles: true,
|
||||
absolute: true,
|
||||
});
|
||||
await Promise.all(
|
||||
typeDefs.map(async file => {
|
||||
const source = await fs.readFile(file, 'utf-8');
|
||||
@@ -223,7 +226,11 @@ async function rewriteLocalImports(
|
||||
tempDirectory: string,
|
||||
packages: $ReadOnlyArray<{directory: string, name: string}>,
|
||||
) {
|
||||
const definitions = glob.sync(`${tempDirectory}/**/*.d.ts`);
|
||||
const definitions = globSync('**/*.d.ts', {
|
||||
cwd: tempDirectory,
|
||||
onlyFiles: true,
|
||||
absolute: true,
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
definitions.map(async file => {
|
||||
|
||||
Reference in new issue
Block a user