mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Migrate Node.js builtin imports to node: scheme (#57611)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57611 Directly follows D112733139 (Metro). **Motivation** - New Node builtins are *only* available under the prefix (e.g. `node:sqlite`), as this allows Node to introduce them without ecosystem-breaking changes, so this is the direction of travel and the only choice that'll allow consistency. - Encouraging them and grouping them separately makes it easier to reason about a module's 3rd party dependencies. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D112803684 fbshipit-source-id: 40668d746a7151b3aa4800ff8af997902a18d198
This commit is contained in:
1 parent
94d208d96f
commit
89300acb9c
271 files changed
+822
-581
No files matched your search
+5
-1
@@ -15,7 +15,7 @@ module.exports = {
|
||||
|
||||
extends: ['@react-native'],
|
||||
|
||||
plugins: ['@react-native/monorepo', '@react-native/specs'],
|
||||
plugins: ['@react-native/monorepo', '@react-native/specs', 'import'],
|
||||
|
||||
overrides: [
|
||||
// overriding the JS config from @react-native/eslint-config to ensure
|
||||
@@ -44,6 +44,7 @@ module.exports = {
|
||||
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
|
||||
rules: {
|
||||
'@react-native/no-deep-imports': 'off',
|
||||
'import/enforce-node-protocol-usage': ['warn', 'always'],
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -66,6 +67,9 @@ module.exports = {
|
||||
rules: {
|
||||
'@react-native/monorepo/valid-flow-typed-signature': 'error',
|
||||
'ft-flow/require-valid-file-annotation': 'off',
|
||||
// These libdefs are kept byte-identical across projects (see
|
||||
// flow-typed-sync-test), so they must not be migrated independently.
|
||||
'import/enforce-node-protocol-usage': 'off',
|
||||
'no-shadow': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
quotes: 'off',
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-ft-flow": "^2.0.1",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jest": "^29.0.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.6.0",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
let FlowParser, TypeScriptParser, RNCodegen;
|
||||
|
||||
const {cheap: traverseCheap} = require('@babel/traverse').default;
|
||||
const {basename} = require('path');
|
||||
const {basename} = require('node:path');
|
||||
|
||||
try {
|
||||
FlowParser =
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
import getAssetDestPathAndroid from '../getAssetDestPathAndroid';
|
||||
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
jest
|
||||
.dontMock('../getAssetDestPathAndroid')
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
import getAssetDestPathIOS from '../getAssetDestPathIOS';
|
||||
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
jest.dontMock('../getAssetDestPathIOS');
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
import type {AssetData} from 'metro';
|
||||
|
||||
import {getAndroidResourceIdentifier} from '@react-native/asset-utils';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
export function cleanAssetCatalog(catalogDir: string): void {
|
||||
const files = fs
|
||||
|
||||
@@ -14,10 +14,10 @@ import type {RunBuildOptions} from 'metro';
|
||||
import loadMetroConfig from '../../utils/loadMetroConfig';
|
||||
import parseKeyValueParamArray from '../../utils/parseKeyValueParamArray';
|
||||
import saveAssets from './saveAssets';
|
||||
import {promises as fs} from 'fs';
|
||||
import {runBuild} from 'metro';
|
||||
import path from 'path';
|
||||
import {styleText} from 'util';
|
||||
import {promises as fs} from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {styleText} from 'node:util';
|
||||
|
||||
type HydratedMetroConfig = Awaited<ReturnType<typeof loadMetroConfig>>;
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
drawableFileTypes,
|
||||
getAndroidResourceIdentifier,
|
||||
} from '@react-native/asset-utils';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
async function createKeepFileAsync(
|
||||
assets: ReadonlyArray<AssetData>,
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
getAndroidResourceFolderName,
|
||||
getAndroidResourceIdentifier,
|
||||
} from '@react-native/asset-utils';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
function getAssetDestPathAndroid(asset: PackagerAsset, scale: number): string {
|
||||
const androidFolder = getAndroidResourceFolderName(asset, scale);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {PackagerAsset} from '@react-native/asset-utils';
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
function getAssetDestPathIOS(asset: PackagerAsset, scale: number): string {
|
||||
const suffix = scale === 1 ? '' : `@${scale}x`;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import type {Command} from '@react-native-community/cli-types';
|
||||
|
||||
import buildBundle from './buildBundle';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
export type {BundleCommandArgs} from './buildBundle';
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ import createKeepFileAsync from './createKeepFileAsync';
|
||||
import filterPlatformAssetScales from './filterPlatformAssetScales';
|
||||
import getAssetDestPathAndroid from './getAssetDestPathAndroid';
|
||||
import getAssetDestPathIOS from './getAssetDestPathIOS';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import {styleText} from 'util';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {styleText} from 'node:util';
|
||||
|
||||
type CopiedFiles = {
|
||||
[src: string]: string,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {TerminalReporter} from 'metro';
|
||||
|
||||
import {styleText} from 'util';
|
||||
import {styleText} from 'node:util';
|
||||
|
||||
type PageDescription = Readonly<{
|
||||
id: string,
|
||||
|
||||
@@ -12,9 +12,9 @@ import type {TerminalReporter} from 'metro';
|
||||
|
||||
import OpenDebuggerKeyboardHandler from './OpenDebuggerKeyboardHandler';
|
||||
import invariant from 'invariant';
|
||||
import readline from 'readline';
|
||||
import {ReadStream} from 'tty';
|
||||
import {styleText} from 'util';
|
||||
import readline from 'node:readline';
|
||||
import {ReadStream} from 'node:tty';
|
||||
import {styleText} from 'node:util';
|
||||
|
||||
const CTRL_C = '\u0003';
|
||||
const CTRL_D = '\u0004';
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import type {Command} from '@react-native-community/cli-types';
|
||||
|
||||
import runServer from './runServer';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
export type {StartCommandArgs} from './runServer';
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ import attachKeyHandlers from './attachKeyHandlers';
|
||||
import {createDevServerMiddleware} from './middleware';
|
||||
import {createDevMiddleware} from '@react-native/dev-middleware';
|
||||
import * as Metro from 'metro';
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
import {styleText} from 'util';
|
||||
import path from 'node:path';
|
||||
import url from 'node:url';
|
||||
import {styleText} from 'node:util';
|
||||
|
||||
export type StartCommandArgs = {
|
||||
assetPlugins?: string[],
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import net from 'net';
|
||||
import net from 'node:net';
|
||||
|
||||
/**
|
||||
* Determine whether we can run the dev server.
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
import type {Config} from '@react-native-community/cli-types';
|
||||
import type {TerminalReporter} from 'metro';
|
||||
|
||||
import {styleText} from 'node:util';
|
||||
import semver from 'semver';
|
||||
import {styleText} from 'util';
|
||||
|
||||
const debug = require('debug')('ReactNative:CommunityCliPlugin');
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
let frontEndPath /*:string */ = path.join(
|
||||
__dirname,
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
const {
|
||||
prepareDebuggerShellFromDotSlashFile,
|
||||
} = require('../src/node/private/LaunchUtils');
|
||||
const fs = require('fs').promises;
|
||||
const http = require('http');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs').promises;
|
||||
const http = require('node:http');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
// The implementation of prepareDebuggerShellFromDotSlashFile relies on
|
||||
// details of DotSlash that are not guaranteed to be stable (support for
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
import {configureAppMenu} from './AppMenu.js';
|
||||
import SettingsStore from './SettingsStore.js';
|
||||
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const path = require('node:path');
|
||||
const util = require('node:util');
|
||||
|
||||
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
|
||||
const {BrowserWindow, app, shell, ipcMain} = require('electron') as any;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
|
||||
const {app} = require('electron') as any;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
type Options = Readonly<{
|
||||
name?: string,
|
||||
|
||||
@@ -12,7 +12,7 @@ import buildInfo from './BuildInfo';
|
||||
|
||||
// $FlowFixMe[untyped-import] Flow doesn't infer JSON types
|
||||
const pkg = require('../../package.json');
|
||||
const util = require('util');
|
||||
const util = require('node:util');
|
||||
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
|
||||
const {app} = require('electron') as any;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import {prepareDebuggerShellFromDotSlashFile} from './private/LaunchUtils';
|
||||
|
||||
const {spawn} = require('cross-spawn');
|
||||
const debug = require('debug')('Metro:DebuggerShell');
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
// The 'prebuilt' flavor will use the prebuilt shell binary (and the JavaScript embedded in it).
|
||||
// The 'dev' flavor will use a stock Electron binary and run the shell code from the `electron/` directory.
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
serveStaticText,
|
||||
withServerForEachTest,
|
||||
} from './ServerUtils';
|
||||
import {createHash} from 'crypto';
|
||||
import {createHash} from 'node:crypto';
|
||||
|
||||
// WebSocket is unreliable when using fake timers.
|
||||
jest.useRealTimers();
|
||||
|
||||
@@ -13,8 +13,8 @@ import type {HandleFunction} from 'connect';
|
||||
|
||||
import {createDevMiddleware} from '../';
|
||||
import connect from 'connect';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
import * as selfsigned from 'selfsigned';
|
||||
|
||||
type CreateDevMiddlewareOptions = Parameters<typeof createDevMiddleware>[0];
|
||||
|
||||
@@ -21,7 +21,7 @@ import openDebuggerMiddleware from './middleware/openDebuggerMiddleware';
|
||||
import DefaultToolLauncher from './utils/DefaultToolLauncher';
|
||||
import reactNativeDebuggerFrontendPath from '@react-native/debugger-frontend';
|
||||
import connect from 'connect';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
import serveStaticMiddleware from 'serve-static';
|
||||
|
||||
type Options = Readonly<{
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
*/
|
||||
|
||||
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
|
||||
import type {Timeout} from 'timers';
|
||||
import type {Timeout} from 'node:timers';
|
||||
|
||||
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
|
||||
import {setTimeout} from 'timers';
|
||||
import util from 'util';
|
||||
import {setTimeout} from 'node:timers';
|
||||
import util from 'node:util';
|
||||
|
||||
const debug = require('debug')('Metro:InspectorProxy');
|
||||
const debugCDPMessages = require('debug')('Metro:InspectorProxyCDPMessages');
|
||||
|
||||
@@ -30,8 +30,8 @@ import type {
|
||||
|
||||
import CdpDebugLogging from './CdpDebugLogging';
|
||||
import DeviceEventReporter from './DeviceEventReporter';
|
||||
import crypto from 'crypto';
|
||||
import invariant from 'invariant';
|
||||
import crypto from 'node:crypto';
|
||||
import WS from 'ws';
|
||||
|
||||
const debug = require('debug')('Metro:InspectorProxy');
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
import type {DebuggerSessionIDs} from '../types/EventReporter';
|
||||
|
||||
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
|
||||
import {monitorEventLoopDelay, performance} from 'perf_hooks';
|
||||
import {monitorEventLoopDelay, performance} from 'node:perf_hooks';
|
||||
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
|
||||
import {setTimeout} from 'timers';
|
||||
import {setTimeout} from 'node:timers';
|
||||
|
||||
export type EventLoopPerfTrackerArgs = {
|
||||
perfMeasurementDuration: number,
|
||||
|
||||
@@ -20,7 +20,7 @@ import type {
|
||||
Page,
|
||||
PageDescription,
|
||||
} from './types';
|
||||
import type {IncomingMessage, ServerResponse} from 'http';
|
||||
import type {IncomingMessage, ServerResponse} from 'node:http';
|
||||
|
||||
import getBaseUrlFromRequest from '../utils/getBaseUrlFromRequest';
|
||||
import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
*/
|
||||
|
||||
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
|
||||
import type {Timeout} from 'timers';
|
||||
import type {Timeout} from 'node:timers';
|
||||
|
||||
// Import these from node:timers to get the correct Flow types.
|
||||
// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS
|
||||
import {clearTimeout, setTimeout} from 'timers';
|
||||
import {clearTimeout, setTimeout} from 'node:timers';
|
||||
import WS from 'ws';
|
||||
|
||||
export type HeartbeatTrackerArgs = {
|
||||
|
||||
@@ -19,10 +19,10 @@ import type {Experiments} from '../types/Experiments';
|
||||
import type {Logger} from '../types/Logger';
|
||||
import type {ReadonlyURL} from '../types/ReadonlyURL';
|
||||
import type {NextHandleFunction} from 'connect';
|
||||
import type {IncomingMessage, ServerResponse} from 'http';
|
||||
import type {IncomingMessage, ServerResponse} from 'node:http';
|
||||
|
||||
import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
|
||||
import {createHash} from 'crypto';
|
||||
import {createHash} from 'node:crypto';
|
||||
|
||||
const LEGACY_SYNTHETIC_PAGE_TITLE =
|
||||
'React Native Experimental (Improved Chrome Reloads)';
|
||||
|
||||
@@ -14,9 +14,9 @@ const {
|
||||
unstable_prepareDebuggerShell,
|
||||
unstable_spawnDebuggerShellWithArgs,
|
||||
} = require('@react-native/debugger-shell');
|
||||
const {spawn} = require('child_process');
|
||||
const ChromeLauncher = require('chrome-launcher');
|
||||
const {Launcher: EdgeLauncher} = require('chromium-edge-launcher');
|
||||
const {spawn} = require('node:child_process');
|
||||
const open = require('open');
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @noflow
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
/**
|
||||
* script to prepare package for publish.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @noflow
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
/**
|
||||
* script to prepare package for publish.
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
const withBabelRegister = require('./with-babel-register');
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
// We use the prepack hook before publishing package to set this value to true
|
||||
const PACKAGE_USAGE = false;
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
* @noflow
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const {sync: makeDirSync} = require('make-dir');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
const packageJson = JSON.parse(
|
||||
fs.readFileSync(require.resolve('../package.json'), 'utf8'),
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
const diskCache = require('./disk-cache');
|
||||
const babel = require('@babel/core');
|
||||
const {DEFAULT_EXTENSIONS, OptionManager} = require('@babel/core');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const {addHook} = require('pirates');
|
||||
const sourceMapSupport = require('source-map-support');
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
module.exports = {
|
||||
haste: {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
const createCacheKeyFunction =
|
||||
require('@jest/create-cache-key-function').default;
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
// NOTE: This file used to be at `react-native/jest/assetFileTransformer.js`
|
||||
// To keep the mock `testUri` paths the same, we create a fake path that outputs the same relative path as before
|
||||
|
||||
@@ -81,7 +81,7 @@ try {
|
||||
*/
|
||||
jest.mock('prettier', () => {
|
||||
// $FlowExpectedError[underconstrained-implicit-instantiation]
|
||||
const module = jest.requireActual('module');
|
||||
const module = jest.requireActual('node:module');
|
||||
return module.prototype.require(require.resolve('prettier'));
|
||||
});
|
||||
} catch {}
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@
|
||||
// $FlowExpectedError[untyped-import] - Preset is untyped
|
||||
const preset = require('../index');
|
||||
const babel = require('@babel/core');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const FIXTURES_DIR = path.join(__dirname, '__fixtures__');
|
||||
const OUTPUT_DIR = path.join(FIXTURES_DIR, 'output');
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ module.exports.getCacheKey = () => {
|
||||
// For anyone working with a `-main` version, contents may vary over time
|
||||
// even though the version does not. Hash the relevant contents of this
|
||||
// package. Lazy-load dependencies we only need on this slow path.
|
||||
const {createHash} = require('crypto');
|
||||
const {readFileSync} = require('fs');
|
||||
const {createHash} = require('node:crypto');
|
||||
const {readFileSync} = require('node:fs');
|
||||
const key = createHash('md5');
|
||||
[
|
||||
readFileSync(__filename),
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
const {transform} = require('../index.js');
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
const PROJECT_ROOT = path.sep === '/' ? '/my/project' : 'C:\\my\\project';
|
||||
|
||||
|
||||
+3
-3
@@ -25,10 +25,10 @@ import type {
|
||||
const {parseSync, transformFromAstSync} = require('@babel/core');
|
||||
const {getCacheKey: getPresetCacheKey} = require('@react-native/babel-preset');
|
||||
const makeHMRConfig = require('@react-native/babel-preset/src/configs/hmr');
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const crypto = require('node:crypto');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const nullthrows = require('nullthrows');
|
||||
const path = require('path');
|
||||
|
||||
const cacheKeyParts = [getPresetCacheKey(), fs.readFileSync(__filename)];
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateComponentDescriptorH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentHObjCpp-test.js
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateComponentHObjCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateEventEmitterCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateEventEmitterH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsJavaDelegate');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsJavaInterface');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
const fixtures = fs.readdirSync(FIXTURE_DIR);
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateShadowNodeCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
const fixtures = fs.readdirSync(FIXTURE_DIR);
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateShadowNodeH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
const fixtures = fs.readdirSync(FIXTURE_DIR);
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateViewConfigJs');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import type {SchemaType} from '../../../../src/CodegenSchema';
|
||||
|
||||
const generator = require('../../../../src/generators/modules/GenerateModuleH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ import type {SchemaType} from '../../../../src/CodegenSchema';
|
||||
|
||||
const generator = require('../../../../src/generators/modules/GenerateModuleObjCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateComponentDescriptorH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateComponentHObjCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateEventEmitterCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateEventEmitterH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsJavaDelegate');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaInterface-test.js
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GeneratePropsJavaInterface');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
const fixtures = fs.readdirSync(FIXTURE_DIR);
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateShadowNodeCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
const fixtures = fs.readdirSync(FIXTURE_DIR);
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateShadowNodeH');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
const fixtures = fs.readdirSync(FIXTURE_DIR);
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const generator = require('../../../../src/generators/components/GenerateViewConfigJs');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
||||
|
||||
|
||||
+3
-3
@@ -24,12 +24,12 @@
|
||||
'use strict';
|
||||
|
||||
const babel = require('@babel/core');
|
||||
const fs = require('fs');
|
||||
const micromatch = require('micromatch');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const {styleText} = require('node:util');
|
||||
const prettier = require('prettier');
|
||||
const {globSync} = require('tinyglobby');
|
||||
const {styleText} = require('util');
|
||||
|
||||
const prettierConfig = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, '..', 'build.prettierrc'), 'utf8'),
|
||||
|
||||
@@ -14,8 +14,8 @@ import type {SchemaType} from '../../CodegenSchema.js';
|
||||
const {FlowParser} = require('../../parsers/flow/parser');
|
||||
const {TypeScriptParser} = require('../../parsers/typescript/parser');
|
||||
const {filterJSFile} = require('./combine-utils');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const {globSync} = require('tinyglobby');
|
||||
|
||||
const flowParser = new FlowParser();
|
||||
|
||||
@@ -16,8 +16,8 @@ import type {
|
||||
SchemaType,
|
||||
} from '../../CodegenSchema.js';
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const assert = require('node:assert');
|
||||
const fs = require('node:fs');
|
||||
const yargs = require('yargs');
|
||||
|
||||
const argv = yargs
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
/**
|
||||
* This function is used by the CLI to decide whether a JS/TS file has to be
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
'use strict';
|
||||
|
||||
const RNCodegen = require('../../generators/RNCodegen.js');
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length < 3) {
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
const {FlowParser} = require('../../parsers/flow/parser');
|
||||
const {TypeScriptParser} = require('../../parsers/typescript/parser');
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
const flowParser = new FlowParser();
|
||||
const typescriptParser = new TypeScriptParser();
|
||||
|
||||
@@ -35,8 +35,8 @@ const generateModuleJavaSpec = require('./modules/GenerateModuleJavaSpec.js');
|
||||
const generateModuleJniCpp = require('./modules/GenerateModuleJniCpp.js');
|
||||
const generateModuleJniH = require('./modules/GenerateModuleJniH.js');
|
||||
const generateModuleObjCpp = require('./modules/GenerateModuleObjCpp');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const ALL_GENERATORS = {
|
||||
generateComponentDescriptorH: generateComponentDescriptorH.generate,
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('RNCodegen.generate', () => {
|
||||
});
|
||||
|
||||
it('when type `all`, with default paths', () => {
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
existsSync: location => {
|
||||
return true;
|
||||
},
|
||||
@@ -29,7 +29,7 @@ describe('RNCodegen.generate', () => {
|
||||
// Jest in the OSS does not allow to capture variables in closures.
|
||||
// Therefore, we have to bring the variables inside the closure.
|
||||
// see: https://github.com/facebook/jest/issues/2567
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
const outputDirectory = 'tmp/out/';
|
||||
const componentsOutputDir = 'react/renderer/components/library';
|
||||
const modulesOutputDir = 'library';
|
||||
|
||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ const failureFixtures = require('../__test_fixtures__/failures.js');
|
||||
const fixtures = require('../__test_fixtures__/fixtures.js');
|
||||
const {FlowParser} = require('../../parser');
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readFileSync: filename => {
|
||||
// Jest in the OSS does not allow to capture variables in closures.
|
||||
// Therefore, we have to bring the variables inside the closure.
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ const {FlowParser} = require('../../parser');
|
||||
|
||||
const flowParser = new FlowParser();
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readFileSync: filename => {
|
||||
// Jest in the OSS does not allow to capture variables in closures.
|
||||
// Therefore, we have to bring the variables inside the closure.
|
||||
|
||||
@@ -56,8 +56,8 @@ const {
|
||||
} = require('./components/componentsUtils');
|
||||
const {flowTranslateTypeAnnotation} = require('./modules');
|
||||
const {parseFlowAndThrowErrors} = require('./parseFlowAndThrowErrors');
|
||||
const fs = require('fs');
|
||||
const invariant = require('invariant');
|
||||
const fs = require('node:fs');
|
||||
|
||||
type ExtendsForProp = null | {
|
||||
type: 'ReactNativeBuiltInType',
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ const failureFixtures = require('../__test_fixtures__/failures.js');
|
||||
const fixtures = require('../__test_fixtures__/fixtures.js');
|
||||
const {TypeScriptParser} = require('../../parser');
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readFileSync: filename => {
|
||||
// Jest in the OSS does not allow to capture variables in closures.
|
||||
// Therefore, we have to bring the variables inside the closure.
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ const {TypeScriptParser} = require('../../parser');
|
||||
|
||||
const typeScriptParser = new TypeScriptParser();
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readFileSync: filename => {
|
||||
// Jest in the OSS does not allow to capture variables in closures.
|
||||
// Therefore, we have to bring the variables inside the closure.
|
||||
|
||||
@@ -59,8 +59,8 @@ const {typeScriptTranslateTypeAnnotation} = require('./modules');
|
||||
const {parseTopLevelType} = require('./parseTopLevelType');
|
||||
// $FlowFixMe[untyped-import] Use flow-types for @babel/parser
|
||||
const babelParser = require('@babel/parser');
|
||||
const fs = require('fs');
|
||||
const invariant = require('invariant');
|
||||
const fs = require('node:fs');
|
||||
|
||||
class TypeScriptParser implements Parser {
|
||||
typeParameterInstantiation: string = 'TSTypeParameterInstantiation';
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
const {ParserError} = require('./errors');
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe};
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
import type {SchemaType} from '@react-native/codegen/src/CodegenSchema';
|
||||
|
||||
import {FlowParser} from '@react-native/codegen/src/parsers/flow/parser';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
const flowParser = new FlowParser();
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ function extractVersion(tomlContent, regex) {
|
||||
return match && match[1] ? match[1] : null;
|
||||
}
|
||||
|
||||
const fs = require('fs');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const buildGradleKtsPath = 'android/build.gradle.kts';
|
||||
const libsVersionsTomlPath = '../react-native/gradle/libs.versions.toml';
|
||||
|
||||
@@ -14,8 +14,8 @@ import type {ExceptionData} from '../NativeExceptionsManager';
|
||||
|
||||
const ExceptionsManager = require('../ExceptionsManager').default;
|
||||
const ReactFiberErrorDialog = require('../ReactFiberErrorDialog').default;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const capturedErrorDefaults = {
|
||||
componentName: 'A',
|
||||
|
||||
+3
-3
@@ -26,9 +26,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('node:crypto');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
// SignedSource token - this placeholder gets replaced with the actual hash
|
||||
// Use string concatenation to avoid marking THIS script as generated
|
||||
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
||||
|
||||
// $FlowFixMe[untyped-import]
|
||||
const {name} = require('./package.json');
|
||||
const {styleText} = require('util');
|
||||
const {styleText} = require('node:util');
|
||||
|
||||
const deprecated = () => {
|
||||
throw new Error(
|
||||
|
||||
@@ -16,7 +16,7 @@ import type {ConfigT} from 'metro-config';
|
||||
|
||||
const {getDefaultConfig} = require('@react-native/metro-config');
|
||||
const {mergeConfig} = require('metro-config');
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
/**
|
||||
* This cli config is needed for development purposes, e.g. for running
|
||||
|
||||
+3
-3
@@ -11,10 +11,10 @@
|
||||
'use strict';
|
||||
|
||||
const {bundleCommand: bc} = require('@react-native/community-cli-plugin');
|
||||
const {execSync} = require('child_process');
|
||||
const commander = require('commander');
|
||||
const {readFileSync} = require('fs');
|
||||
const path = require('path');
|
||||
const {execSync} = require('node:child_process');
|
||||
const {readFileSync} = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
// Commander 12.0.0 changes from the global to named export
|
||||
// $FlowFixMe[signature-verification-failure]
|
||||
|
||||
+10
-10
@@ -19,8 +19,8 @@ const {
|
||||
cleanupEmptyFilesAndFolders,
|
||||
extractLibrariesFromJSON,
|
||||
} = require('../generate-artifacts-executor/utils');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const rootPath = path.join(__dirname, '../../..');
|
||||
|
||||
@@ -186,7 +186,7 @@ describe('delete empty files and folders', () => {
|
||||
let statSyncInvocationCount = 0;
|
||||
let rmSyncInvocationCount = 0;
|
||||
let rmdirSyncInvocationCount = 0;
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
statSync: filepath => {
|
||||
statSyncInvocationCount += 1;
|
||||
expect(filepath).toBe(targetFilepath);
|
||||
@@ -221,7 +221,7 @@ describe('delete empty files and folders', () => {
|
||||
let rmSyncInvocationCount = 0;
|
||||
let rmdirSyncInvocationCount = 0;
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
statSync: filepath => {
|
||||
statSyncInvocationCount += 1;
|
||||
expect(filepath).toBe(targetFilepath);
|
||||
@@ -256,7 +256,7 @@ describe('delete empty files and folders', () => {
|
||||
let rmSyncInvocationCount = 0;
|
||||
let rmdirSyncInvocationCount = 0;
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
statSync: filepath => {
|
||||
statSyncInvocationCount += 1;
|
||||
expect(filepath).toBe(targetFolder);
|
||||
@@ -306,7 +306,7 @@ describe('delete empty files and folders', () => {
|
||||
let rmdirSyncInvocation = [];
|
||||
let readdirInvocation = [];
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
statSync: filepath => {
|
||||
statSyncInvocation.push(filepath);
|
||||
|
||||
@@ -357,7 +357,7 @@ describe('delete empty files and folders', () => {
|
||||
let rmdirSyncInvocation = [];
|
||||
let readdirInvocation = [];
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
statSync: filepath => {
|
||||
statSyncInvocation.push(filepath);
|
||||
|
||||
@@ -416,7 +416,7 @@ describe('findFilesWithExtension', () => {
|
||||
it('skips hidden files and folders', () => {
|
||||
const targetFolder = '/project/ios';
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readdirSync: dirPath => {
|
||||
if (dirPath === targetFolder) {
|
||||
return ['.hidden', '.git', 'visible.mm'];
|
||||
@@ -443,7 +443,7 @@ describe('findFilesWithExtension', () => {
|
||||
const pnpmFolder = path.join(targetFolder, '.pnpm');
|
||||
const packageFolder = path.join(pnpmFolder, 'some-package');
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readdirSync: dirPath => {
|
||||
if (dirPath === targetFolder) {
|
||||
return ['.pnpm', '.hidden'];
|
||||
@@ -479,7 +479,7 @@ describe('findFilesWithExtension', () => {
|
||||
// like ~/.jenkins/workspace/ or /.hidden-ci/builds/
|
||||
const targetFolder = '/.jenkins/workspace/my-project/ios';
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readdirSync: dirPath => {
|
||||
if (dirPath === targetFolder) {
|
||||
return ['Components'];
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
|
||||
const fixtures = require('../__fixtures__/fixtures');
|
||||
const sut = require('../generate-specs-cli-executor');
|
||||
const {normalize} = require('path');
|
||||
const {normalize} = require('node:path');
|
||||
|
||||
describe('generateSpec', () => {
|
||||
it('invokes RNCodegen with the right params', () => {
|
||||
@@ -27,7 +27,7 @@ describe('generateSpec', () => {
|
||||
// Create a mock for fs.mkdirSync
|
||||
const mkdirSyncMock = jest.fn();
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
jest.mock('node:fs', () => ({
|
||||
readFileSync: (path, encoding) => {
|
||||
expect(path).toBe(schemaPath);
|
||||
expect(encoding).toBe('utf-8');
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const REACT_NATIVE_REPOSITORY_ROOT = path.join(
|
||||
__dirname,
|
||||
|
||||
Vendored
+2
-2
@@ -11,8 +11,8 @@
|
||||
'use strict';
|
||||
const {TEMPLATES_FOLDER_PATH, packageJson} = require('./constants');
|
||||
const {codegenLog, writeFileSyncIfChanged} = require('./utils');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const APP_DEPENDENCY_PROVIDER_H_TEMPLATE_PATH = path.join(
|
||||
TEMPLATES_FOLDER_PATH,
|
||||
|
||||
Vendored
+2
-2
@@ -12,8 +12,8 @@
|
||||
|
||||
const {TEMPLATES_FOLDER_PATH} = require('./constants');
|
||||
const {parseiOSAnnotations, writeFileSyncIfChanged} = require('./utils');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const MODULES_PROTOCOLS_H_TEMPLATE_PATH = path.join(
|
||||
TEMPLATES_FOLDER_PATH,
|
||||
|
||||
+3
-3
@@ -13,9 +13,9 @@
|
||||
const generateSpecsCLIExecutor = require('../generate-specs-cli-executor');
|
||||
const {CORE_LIBRARIES_WITH_OUTPUT_FOLDER} = require('./constants');
|
||||
const {codegenLog, cpSyncRecursiveIfChanged} = require('./utils');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
function generateNativeCode(
|
||||
outputPath /*: string */,
|
||||
|
||||
+2
-2
@@ -11,8 +11,8 @@
|
||||
'use strict';
|
||||
const {TEMPLATES_FOLDER_PATH} = require('./constants');
|
||||
const {codegenLog, writeFileSyncIfChanged} = require('./utils');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const PACKAGE_SWIFT_TEMPLATE_PATH = path.join(
|
||||
TEMPLATES_FOLDER_PATH,
|
||||
|
||||
Vendored
+2
-2
@@ -16,8 +16,8 @@ const {
|
||||
parseiOSAnnotations,
|
||||
writeFileSyncIfChanged,
|
||||
} = require('./utils');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const MODULE_PROVIDERS_H_TEMPLATE_PATH = path.join(
|
||||
TEMPLATES_FOLDER_PATH,
|
||||
|
||||
Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user