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
+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');
|
||||
|
||||
|
||||
Reference in new issue
Block a user