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
@@ -22,13 +22,13 @@ const {
|
||||
ExtractorConfig,
|
||||
// $FlowFixMe[cannot-resolve-module]
|
||||
} = require('@microsoft/api-extractor');
|
||||
const {promises: fs} = require('fs');
|
||||
const {diff} = require('jest-diff');
|
||||
const path = require('path');
|
||||
const {promises: fs} = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const {styleText} = require('node:util');
|
||||
const prettier = require('prettier');
|
||||
const osTempDir = require('temp-dir');
|
||||
const {globSync} = require('tinyglobby');
|
||||
const {styleText} = require('util');
|
||||
|
||||
const inputFilesPostTransforms: ReadonlyArray<PluginObj<unknown>> = [
|
||||
require('./transforms/typescript/renameDefaultExportedIdentifiers'),
|
||||
|
||||
@@ -13,10 +13,10 @@ const {ENTRY_POINT, IGNORE_PATTERNS, TYPES_OUTPUT_DIR} = require('../config');
|
||||
const getRequireStack = require('./resolution/getRequireStack');
|
||||
const translatedModuleTemplate = require('./templates/translatedModule.d.ts-template');
|
||||
const translateSourceFile = require('./translateSourceFile');
|
||||
const {promises: fs, watch: fsWatch} = require('fs');
|
||||
const micromatch = require('micromatch');
|
||||
const path = require('path');
|
||||
const {styleText} = require('util');
|
||||
const {promises: fs, watch: fsWatch} = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const {styleText} = require('node:util');
|
||||
|
||||
/**
|
||||
* Build generated TypeScript types for react-native.
|
||||
|
||||
@@ -16,7 +16,7 @@ const {
|
||||
watchGeneratedTypes,
|
||||
} = require('./buildGeneratedTypes');
|
||||
const debug = require('debug');
|
||||
const {parseArgs, styleText} = require('util');
|
||||
const {parseArgs, styleText} = require('node:util');
|
||||
|
||||
const config = {
|
||||
options: {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
const {REPO_ROOT} = require('../../../shared/consts');
|
||||
const debug = require('debug')('build-types:resolution');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const TYPEDEF_MAPPING: Record<string, ReadonlyArray<string>> = {
|
||||
'.android.js': ['.js.flow', '.js'],
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
const {PACKAGES_DIR} = require('../../../shared/consts');
|
||||
const {getPackages} = require('../../../shared/monorepoUtils');
|
||||
const {existsSync} = require('fs');
|
||||
const path = require('path');
|
||||
const {existsSync} = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
export type DependencyContext = Readonly<{
|
||||
reportUnresolvedDependency(importPath: string): void,
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@
|
||||
|
||||
const organizeDeclarations = require('../organizeDeclarations');
|
||||
const babel = require('@babel/core');
|
||||
const {promises: fs} = require('fs');
|
||||
const path = require('path');
|
||||
const {promises: fs} = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
async function translate(code: string): Promise<string> {
|
||||
const result = await babel.transformAsync(code, {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
const sortPropertiesVisitor = require('../sortProperties');
|
||||
const babel = require('@babel/core');
|
||||
const {promises: fs} = require('fs');
|
||||
const path = require('path');
|
||||
const {promises: fs} = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
async function translate(code: string): Promise<string> {
|
||||
const result = await babel.transformAsync(code, {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
const sortUnionsVisitor = require('../sortUnions');
|
||||
const babel = require('@babel/core');
|
||||
const {promises: fs} = require('fs');
|
||||
const path = require('path');
|
||||
const {promises: fs} = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
async function translate(code: string): Promise<string> {
|
||||
const result = await babel.transformAsync(code, {
|
||||
|
||||
@@ -14,8 +14,8 @@ const generate = require('@babel/generator').default;
|
||||
const {parse} = require('@babel/parser');
|
||||
const traverse = require('@babel/traverse').default;
|
||||
const t = require('@babel/types');
|
||||
const {createHash} = require('crypto');
|
||||
const debug = require('debug')('build-types:transforms:versionExportedApis');
|
||||
const {createHash} = require('node:crypto');
|
||||
|
||||
/**
|
||||
* A visitor that annotates all exported types in the API snapshot with a
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
const resolveCyclicImportsInDefinition = require('../resolveCyclicImportsInDefinition');
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
const packagesPath = '/path/to/package/definition/files';
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import type {PluginObj} from '@babel/core';
|
||||
|
||||
import * as babel from '@babel/core';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
type PackageConfig = ReadonlyArray<{
|
||||
directory: string,
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
require('../../shared/babelRegister').registerForScript();
|
||||
|
||||
const {diffApiSnapshot} = require('./diffApiSnapshot');
|
||||
const fs = require('fs');
|
||||
const {parseArgs} = require('util');
|
||||
const fs = require('node:fs');
|
||||
const {parseArgs} = require('node:util');
|
||||
|
||||
const config = {
|
||||
allowPositionals: true,
|
||||
|
||||
Reference in new issue
Block a user