Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"eslint-plugin-relay": "^1.8.3",
"flow-api-translator": "0.25.1",
"flow-bin": "^0.259.1",
"glob": "^7.1.1",
"glob": "^10.4.5",
"hermes-eslint": "0.25.1",
"hermes-transform": "0.25.1",
"inquirer": "^7.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
"dependencies": {
"@babel/parser": "^7.25.3",
"glob": "^7.1.1",
"glob": "^10.4.5",
"hermes-parser": "0.25.1",
"invariant": "^2.2.4",
"jscodeshift": "^17.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-codegen/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
const babel = require('@babel/core');
const chalk = require('chalk');
const fs = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const micromatch = require('micromatch');
const path = require('path');
const prettier = require('prettier');
Expand Down Expand Up @@ -105,7 +105,7 @@ function buildFile(file, silent) {

const srcDir = path.resolve(__dirname, '..', SRC_DIR);
const pattern = path.resolve(srcDir, '**/*');
const files = glob.sync(pattern, {nodir: true});
const files = globSync(pattern, {nodir: true});

process.stdout.write(fixedWidth(`${path.basename(PACKAGE_DIR)}\n`));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 {globSync} = require('glob');
const path = require('path');

const flowParser = new FlowParser();
Expand Down Expand Up @@ -58,13 +58,10 @@ function expandDirectoriesIntoFiles(
if (!fs.lstatSync(file).isDirectory()) {
return [file];
}
const filePattern = path.sep === '\\' ? file.replace(/\\/g, '/') : file;
return glob.sync(`${filePattern}/**/*.{js,ts,tsx}`, {
return globSync('**/*.{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,
absolute: true,
cwd: file,
});
})
.filter(element => filterJSFile(element, platform, exclude));
Expand Down
16 changes: 7 additions & 9 deletions packages/react-native/Libraries/__tests__/public-api-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {TransformVisitor} from 'hermes-transform';

const translate = require('flow-api-translator');
const {existsSync, promises: fs} = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const {transform} = require('hermes-transform');
const path = require('path');

Expand Down Expand Up @@ -51,18 +51,16 @@ const JS_PRIVATE_FILES_IGNORE_PATTERNS = SHARED_PATTERNS;

const sourceFiles = [
'index.js',
...glob.sync(JS_LIBRARIES_FILES_PATTERN, {
...globSync(JS_LIBRARIES_FILES_PATTERN, {
cwd: PACKAGE_ROOT,
ignore: JS_LIBRARIES_FILES_IGNORE_PATTERNS,
nodir: true,
}),
...JS_PRIVATE_FILES_INCLUDE_PATTERNS.flatMap(srcPrivateSubpath =>
glob.sync(path.join('src', 'private', srcPrivateSubpath), {
cwd: PACKAGE_ROOT,
ignore: JS_PRIVATE_FILES_IGNORE_PATTERNS,
nodir: true,
}),
),
...globSync(JS_PRIVATE_FILES_INCLUDE_PATTERNS, {
cwd: path.join(PACKAGE_ROOT, 'src', 'private'),
ignore: JS_PRIVATE_FILES_IGNORE_PATTERNS,
nodir: true,
}),
];

describe('public API', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"commander": "^12.0.0",
"event-target-shim": "^5.0.1",
"flow-enums-runtime": "^0.0.6",
"glob": "^7.1.1",
"glob": "^10.4.5",
"invariant": "^2.2.4",
"jest-environment-node": "^29.6.3",
"memoize-one": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const utils = require('./codegen-utils');
const generateSpecsCLIExecutor = require('./generate-specs-cli-executor');
const {execSync} = require('child_process');
const fs = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const os = require('os');
const path = require('path');

Expand Down Expand Up @@ -234,7 +234,7 @@ function getCocoaPodsPlatformKey(platformName) {

function extractSupportedApplePlatforms(dependency, dependencyPath) {
codegenLog('Searching for podspec in the project dependencies.', true);
const podspecs = glob.sync('*.podspec', {cwd: dependencyPath});
const podspecs = globSync('*.podspec', {cwd: dependencyPath});

if (podspecs.length === 0) {
return;
Expand Down
27 changes: 14 additions & 13 deletions scripts/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const babel = require('@babel/core');
const chalk = require('chalk');
const translate = require('flow-api-translator');
const {promises: fs} = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const micromatch = require('micromatch');
const path = require('path');
const prettier = require('prettier');
Expand Down Expand Up @@ -123,15 +123,15 @@ async function buildPackage(packageName /*: string */) {
const {emitTypeScriptDefs} = getBuildOptions(packageName);
const entryPoints = await getEntryPoints(packageName);

const files = glob
.sync(path.resolve(PACKAGES_DIR, packageName, SRC_DIR, '**/*'), {
nodir: true,
})
.filter(
file =>
!entryPoints.has(file) &&
!entryPoints.has(file.replace(/\.js$/, '.flow.js')),
);
const files = globSync('**/*', {
nodir: true,
absolute: true,
cwd: path.resolve(PACKAGES_DIR, packageName, SRC_DIR),
}).filter(
file =>
!entryPoints.has(file) &&
!entryPoints.has(file.replace(/\.js$/, '.flow.js')),
);

process.stdout.write(
`${packageName} ${chalk.dim('.').repeat(72 - packageName.length)} `,
Expand Down Expand Up @@ -411,9 +411,10 @@ function normalizeExportsTarget(target /*: string */) /*: string */ {
}

function validateTypeScriptDefs(packageName /*: string */) {
const files = glob.sync(
path.resolve(PACKAGES_DIR, packageName, BUILD_DIR, '**/*.d.ts'),
);
const files = globSync('**/*.d.ts', {
absolute: true,
cwd: path.resolve(PACKAGES_DIR, packageName, BUILD_DIR),
});
const compilerOptions = {
...getTypeScriptCompilerOptions(packageName),
noEmit: true,
Expand Down
8 changes: 5 additions & 3 deletions scripts/build/buildRNTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const {PACKAGES_DIR} = require('../consts');
const translate = require('flow-api-translator');
const {promises: fs} = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const path = require('path');

const TYPES_DIR = 'new-types';
Expand All @@ -23,9 +23,11 @@ const PATHS = ['Libraries/Animated'];

async function buildRNTypes() {
const files = PATHS.flatMap(src_path =>
glob.sync(path.resolve(PACKAGES_DIR, PACKAGE_NAME, src_path, '**/*.js'), {
globSync('**/*.js', {
nodir: true,
}),
absolute: true,
cwd: path.resolve(PACKAGES_DIR, PACKAGE_NAME, src_path),
})
);

console.log('Building RN types...');
Expand Down
16 changes: 6 additions & 10 deletions scripts/utils/monorepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

const {REPO_ROOT} = require('../consts');
const {promises: fs} = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const path = require('path');

const WORKSPACES_CONFIG = 'packages/*';
Expand Down Expand Up @@ -57,15 +57,11 @@ async function getPackages(
const {includeReactNative, includePrivate = false} = filter;

const packagesEntries = await Promise.all(
glob
.sync(`${WORKSPACES_CONFIG}/package.json`, {
cwd: REPO_ROOT,
absolute: true,
ignore: includeReactNative
? []
: ['packages/react-native/package.json'],
})
.map(parsePackageInfo),
globSync(`${WORKSPACES_CONFIG}/package.json`, {
cwd: REPO_ROOT,
absolute: true,
ignore: includeReactNative ? [] : ['packages/react-native/package.json'],
}).map(parsePackageInfo),
);

return Object.fromEntries(
Expand Down
2 changes: 1 addition & 1 deletion tools/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"private": true,
"dependencies": {
"chalk": "^4.0.0",
"glob": "^7.1.1",
"glob": "^10.4.5",
"ini": "^5.0.0"
}
}
17 changes: 6 additions & 11 deletions tools/api/public-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const chalk = require('chalk');
const {execSync} = require('child_process');
const fs = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const ini = require('ini');
const path = require('path');

Expand Down Expand Up @@ -180,16 +180,11 @@ function main() {

let start = performance.now();

let files /*: string[]*/ = [];
for (const searchGlob of config.include) {
// glob 7 doesn't support searchGlob as a string[]
files = files.concat(
glob.sync(searchGlob, {
ignore: config.exclude,
root: GLOB_PROJECT_ROOT,
}),
);
}
let files = globSync(config.include, {
ignore: config.exclude,
cwd: GLOB_PROJECT_ROOT,
absolute: true,
});
files = Array.from(new Set(files));

// Sort the files to make the output deterministic
Expand Down
Loading