FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<c113b32d0760a4ebca65c42279ebb344>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-config/src/defaults/createModuleIdFactory.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
declare function createModuleIdFactory(): (path: string) => number;
export default createModuleIdFactory;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = createModuleIdFactory;
function createModuleIdFactory() {
const fileToIdMap = new Map();
let nextId = 0;
return (path) => {
let id = fileToIdMap.get(path);
if (typeof id !== "number") {
id = nextId++;
fileToIdMap.set(path, id);
}
return id;
};
}

View File

@@ -0,0 +1,23 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
* @oncall react_native
*/
export default function createModuleIdFactory(): (path: string) => number {
const fileToIdMap: Map<string, number> = new Map();
let nextId = 0;
return (path: string) => {
let id = fileToIdMap.get(path);
if (typeof id !== 'number') {
id = nextId++;
fileToIdMap.set(path, id);
}
return id;
};
}

37
node_modules/metro-config/src/defaults/defaults.d.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<f6c99d0a7ab049bae081532d7fb7cb13>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-config/src/defaults/defaults.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
import type {RootPerfLogger} from '../types';
export {default as defaultCreateModuleIdFactory} from './createModuleIdFactory';
export declare const assetExts: Array<string>;
export declare type assetExts = typeof assetExts;
export declare const assetResolutions: Array<string>;
export declare type assetResolutions = typeof assetResolutions;
export declare const sourceExts: Array<string>;
export declare type sourceExts = typeof sourceExts;
export declare const additionalExts: Array<string>;
export declare type additionalExts = typeof additionalExts;
export declare const moduleSystem: string;
export declare type moduleSystem = typeof moduleSystem;
export declare const platforms: Array<string>;
export declare type platforms = typeof platforms;
export declare const DEFAULT_METRO_MINIFIER_PATH: 'metro-minify-terser';
export declare type DEFAULT_METRO_MINIFIER_PATH =
typeof DEFAULT_METRO_MINIFIER_PATH;
export declare const noopPerfLoggerFactory: () => RootPerfLogger;
export declare type noopPerfLoggerFactory = typeof noopPerfLoggerFactory;

85
node_modules/metro-config/src/defaults/defaults.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.assetResolutions =
exports.assetExts =
exports.additionalExts =
exports.DEFAULT_METRO_MINIFIER_PATH =
void 0;
Object.defineProperty(exports, "defaultCreateModuleIdFactory", {
enumerable: true,
get: function () {
return _createModuleIdFactory.default;
},
});
exports.sourceExts =
exports.platforms =
exports.noopPerfLoggerFactory =
exports.moduleSystem =
void 0;
var _createModuleIdFactory = _interopRequireDefault(
require("./createModuleIdFactory"),
);
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
const assetExts = (exports.assetExts = [
"bmp",
"gif",
"jpg",
"jpeg",
"png",
"psd",
"svg",
"webp",
"xml",
"m4v",
"mov",
"mp4",
"mpeg",
"mpg",
"webm",
"aac",
"aiff",
"caf",
"m4a",
"mp3",
"wav",
"html",
"pdf",
"yaml",
"yml",
"otf",
"ttf",
"zip",
]);
const assetResolutions = (exports.assetResolutions = [
"1",
"1.5",
"2",
"3",
"4",
]);
const sourceExts = (exports.sourceExts = ["js", "jsx", "json", "ts", "tsx"]);
const additionalExts = (exports.additionalExts = ["cjs", "mjs"]);
const moduleSystem = (exports.moduleSystem = require.resolve(
"metro-runtime/src/polyfills/require.js",
));
const platforms = (exports.platforms = ["ios", "android", "windows", "web"]);
const DEFAULT_METRO_MINIFIER_PATH = (exports.DEFAULT_METRO_MINIFIER_PATH =
"metro-minify-terser");
const noopPerfLoggerFactory = () => {
class Logger {
start() {}
end() {}
annotate() {}
point() {}
subSpan() {
return this;
}
}
return new Logger();
};
exports.noopPerfLoggerFactory = noopPerfLoggerFactory;

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import type {PerfLogger, RootPerfLogger} from '../types';
export {default as defaultCreateModuleIdFactory} from './createModuleIdFactory';
export const assetExts: Array<string> = [
// Image formats
'bmp',
'gif',
'jpg',
'jpeg',
'png',
'psd',
'svg',
'webp',
'xml',
// Video formats
'm4v',
'mov',
'mp4',
'mpeg',
'mpg',
'webm',
// Audio formats
'aac',
'aiff',
'caf',
'm4a',
'mp3',
'wav',
// Document formats
'html',
'pdf',
'yaml',
'yml',
// Font formats
'otf',
'ttf',
// Archives (virtual files)
'zip',
];
export const assetResolutions: Array<string> = ['1', '1.5', '2', '3', '4'];
export const sourceExts: Array<string> = ['js', 'jsx', 'json', 'ts', 'tsx'];
export const additionalExts: Array<string> = ['cjs', 'mjs'];
export const moduleSystem: string = require.resolve(
'metro-runtime/src/polyfills/require.js',
);
export const platforms: Array<string> = ['ios', 'android', 'windows', 'web'];
export const DEFAULT_METRO_MINIFIER_PATH = 'metro-minify-terser';
export const noopPerfLoggerFactory = (): RootPerfLogger => {
class Logger {
start() {}
end() {}
annotate() {}
point() {}
subSpan(): PerfLogger {
return this;
}
}
return new Logger();
};

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<53b0e844540afad09974c4bcc9b0668c>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-config/src/defaults/exclusionList.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
declare function exclusionList(
additionalExclusions?: ReadonlyArray<RegExp | string>,
): RegExp;
export default exclusionList;

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = exclusionList;
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
const list = [/\/__tests__\/.*/];
function escapeRegExp(pattern) {
if (pattern instanceof RegExp) {
return pattern.source.replace(/\/|\\\//g, "\\" + _path.default.sep);
} else if (typeof pattern === "string") {
const escaped = pattern.replace(
/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g,
"\\$&",
);
return escaped.replaceAll("/", "\\" + _path.default.sep);
} else {
throw new Error(
`Expected exclusionList to be called with RegExp or string, got: ${typeof pattern}`,
);
}
}
function exclusionList(additionalExclusions) {
return new RegExp(
"(" +
(additionalExclusions || []).concat(list).map(escapeRegExp).join("|") +
")$",
);
}

View File

@@ -0,0 +1,51 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import path from 'path';
const list = [/\/__tests__\/.*/];
function escapeRegExp(pattern: RegExp | string) {
if (pattern instanceof RegExp) {
// the forward slash may or may not be escaped in regular expression depends
// on if it's in brackets. See this post for details
// https://github.com/nodejs/help/issues/3039. The or condition in string
// replace regexp is to cover both use cases.
// We should replace all forward slashes to proper OS specific separators.
// The separator needs to be escaped in the regular expression source string,
// hence the '\\' prefix.
return pattern.source.replace(/\/|\\\//g, '\\' + path.sep);
} else if (typeof pattern === 'string') {
// Make sure all the special characters used by regular expression are properly
// escaped. The string inputs are supposed to match as is.
const escaped = pattern.replace(
/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g,
'\\$&',
);
// convert the '/' into an escaped local file separator. The separator needs
// to be escaped in the regular expression source string, hence the '\\' prefix.
return escaped.replaceAll('/', '\\' + path.sep);
} else {
throw new Error(
`Expected exclusionList to be called with RegExp or string, got: ${typeof pattern}`,
);
}
}
export default function exclusionList(
additionalExclusions?: ReadonlyArray<RegExp | string>,
): RegExp {
return new RegExp(
'(' +
(additionalExclusions || []).concat(list).map(escapeRegExp).join('|') +
')$',
);
}

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<e5a0418bb4c6d80dd2a264f641f81b58>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-config/src/defaults/getMaxWorkers.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
declare function getMaxWorkers(workers: null | undefined | number): number;
export default getMaxWorkers;

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = getMaxWorkers;
var _os = _interopRequireDefault(require("os"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
function getMaxWorkers(workers) {
const cores = _os.default.availableParallelism();
return typeof workers === "number" && Number.isInteger(workers)
? Math.min(cores, workers > 0 ? workers : 1)
: Math.max(1, Math.ceil(cores * (0.5 + 0.5 * Math.exp(-cores * 0.07)) - 1));
}

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
* @oncall react_native
*/
import os from 'os';
export default function getMaxWorkers(workers: ?number): number {
// $FlowFixMe[prop-missing] Missing Flow lib def for availableParallelism
const cores = os.availableParallelism();
return typeof workers === 'number' && Number.isInteger(workers)
? Math.min(cores, workers > 0 ? workers : 1)
: Math.max(1, Math.ceil(cores * (0.5 + 0.5 * Math.exp(-cores * 0.07)) - 1));
}

26
node_modules/metro-config/src/defaults/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<f0029b50ddd46efa01d2a32c9828a0ff>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-config/src/defaults/index.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
import type {ConfigT} from '../types';
declare const $$EXPORT_DEFAULT_DECLARATION$$: {
(rootPath?: string): Promise<ConfigT>;
getDefaultValues: (rootPath?: string) => ConfigT;
};
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
typeof $$EXPORT_DEFAULT_DECLARATION$$;
export default $$EXPORT_DEFAULT_DECLARATION$$;

191
node_modules/metro-config/src/defaults/index.js generated vendored Normal file
View File

@@ -0,0 +1,191 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
var _defaults = require("./defaults");
var _exclusionList = _interopRequireDefault(require("./exclusionList"));
var _getMaxWorkers = _interopRequireDefault(require("./getMaxWorkers"));
var _metroCache = require("metro-cache");
var _metroCore = require("metro-core");
var _TerminalReporter = _interopRequireDefault(
require("metro/private/lib/TerminalReporter"),
);
var os = _interopRequireWildcard(require("os"));
var path = _interopRequireWildcard(require("path"));
function _interopRequireWildcard(e, t) {
if ("function" == typeof WeakMap)
var r = new WeakMap(),
n = new WeakMap();
return (_interopRequireWildcard = function (e, t) {
if (!t && e && e.__esModule) return e;
var o,
i,
f = { __proto__: null, default: e };
if (null === e || ("object" != typeof e && "function" != typeof e))
return f;
if ((o = t ? n : r)) {
if (o.has(e)) return o.get(e);
o.set(e, f);
}
for (const t in e)
"default" !== t &&
{}.hasOwnProperty.call(e, t) &&
((i =
(o = Object.defineProperty) &&
Object.getOwnPropertyDescriptor(e, t)) &&
(i.get || i.set)
? o(f, t, i)
: (f[t] = e[t]));
return f;
})(e, t);
}
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
const getDefaultValues = (projectRoot) => ({
resolver: {
assetExts: _defaults.assetExts,
assetResolutions: _defaults.assetResolutions,
platforms: _defaults.platforms,
sourceExts: _defaults.sourceExts,
blockList: (0, _exclusionList.default)(),
dependencyExtractor: undefined,
disableHierarchicalLookup: false,
emptyModulePath: require.resolve(
"metro-runtime/src/modules/empty-module.js",
),
enableGlobalPackages: false,
extraNodeModules: {},
hasteImplModulePath: undefined,
nodeModulesPaths: [],
resolveRequest: null,
resolverMainFields: ["browser", "main"],
unstable_conditionNames: [],
unstable_conditionsByPlatform: {
web: ["browser"],
},
unstable_enablePackageExports: true,
unstable_incrementalResolution: false,
useWatchman: true,
requireCycleIgnorePatterns: [/(^|\/|\\)node_modules($|\/|\\)/],
unstable_forceFullRefreshPatterns: [],
},
serializer: {
polyfillModuleNames: [],
getRunModuleStatement: (moduleId, globalPrefix) =>
`__r(${JSON.stringify(moduleId)});`,
getPolyfills: () => [],
getModulesRunBeforeMainModule: () => [],
processModuleFilter: (module) => true,
createModuleIdFactory: _defaults.defaultCreateModuleIdFactory,
experimentalSerializerHook: () => {},
customSerializer: null,
isThirdPartyModule: (module) =>
/(?:^|[/\\])node_modules[/\\]/.test(module.path),
},
server: {
enhanceMiddleware: (middleware, _) => middleware,
forwardClientLogs: true,
port: 8081,
rewriteRequestUrl: (url) => url,
unstable_serverRoot: null,
useGlobalHotkey: true,
verifyConnections: false,
tls: false,
},
symbolicator: {
customizeFrame: () => {},
customizeStack: async (stack, _) => stack,
},
transformer: {
assetPlugins: [],
asyncRequireModulePath: "metro-runtime/src/modules/asyncRequire",
assetRegistryPath: "missing-asset-registry-path",
babelTransformerPath: "metro-babel-transformer",
dynamicDepsInPackages: "throwAtRuntime",
enableBabelRCLookup: true,
enableBabelRuntime: true,
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
preloadedModules: false,
ramGroups: [],
}),
globalPrefix: "",
hermesParser: false,
minifierConfig: {
mangle: {
toplevel: false,
},
output: {
ascii_only: true,
quote_style: 3,
wrap_iife: true,
},
sourceMap: {
includeSources: false,
},
toplevel: false,
compress: {
reduce_funcs: false,
},
},
minifierPath: _defaults.DEFAULT_METRO_MINIFIER_PATH,
optimizationSizeLimit: 150 * 1024,
transformVariants: {
default: {},
},
publicPath: "/assets",
allowOptionalDependencies: false,
unstable_allowRequireContext: false,
unstable_dependencyMapReservedName: null,
unstable_disableModuleWrapping: false,
unstable_disableNormalizePseudoGlobals: false,
unstable_renameRequire: true,
unstable_compactOutput: false,
unstable_memoizeInlineRequires: false,
unstable_workerThreads: false,
},
watcher: {
additionalExts: _defaults.additionalExts,
healthCheck: {
enabled: false,
filePrefix: ".metro-health-check",
interval: 30000,
timeout: 5000,
},
unstable_lazySha1: true,
unstable_autoSaveCache: {
enabled: true,
debounceMs: 5000,
},
watchman: {
deferStates: ["hg.update"],
},
},
cacheStores: [
new _metroCache.FileStore({
root: path.join(os.tmpdir(), "metro-cache"),
}),
],
cacheVersion: "1.0",
projectRoot: projectRoot || path.resolve(__dirname, "../../.."),
stickyWorkers: true,
watchFolders: [],
transformerPath: "metro-transform-worker",
maxWorkers: (0, _getMaxWorkers.default)(),
resetCache: false,
reporter: new _TerminalReporter.default(
new _metroCore.Terminal(process.stdout),
),
unstable_perfLoggerFactory: _defaults.noopPerfLoggerFactory,
});
async function getDefaultConfig(rootPath) {
return getDefaultValues(rootPath);
}
getDefaultConfig.getDefaultValues = getDefaultValues;
var _default = (exports.default = getDefaultConfig);

188
node_modules/metro-config/src/defaults/index.js.flow generated vendored Normal file
View File

@@ -0,0 +1,188 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
* @oncall react_native
*/
import type {ConfigT} from '../types';
import {
DEFAULT_METRO_MINIFIER_PATH,
additionalExts,
assetExts,
assetResolutions,
defaultCreateModuleIdFactory,
noopPerfLoggerFactory,
platforms,
sourceExts,
} from './defaults';
import exclusionList from './exclusionList';
import getMaxWorkers from './getMaxWorkers';
import {FileStore} from 'metro-cache';
import {Terminal} from 'metro-core';
import TerminalReporter from 'metro/private/lib/TerminalReporter';
import * as os from 'os';
import * as path from 'path';
const getDefaultValues = (projectRoot: ?string): ConfigT => ({
resolver: {
assetExts,
assetResolutions,
platforms,
sourceExts,
blockList: exclusionList(),
dependencyExtractor: undefined,
disableHierarchicalLookup: false,
emptyModulePath: require.resolve(
'metro-runtime/src/modules/empty-module.js',
),
enableGlobalPackages: false,
extraNodeModules: {},
hasteImplModulePath: undefined,
nodeModulesPaths: [],
resolveRequest: null,
resolverMainFields: ['browser', 'main'],
unstable_conditionNames: [],
unstable_conditionsByPlatform: {
web: ['browser'],
},
unstable_enablePackageExports: true,
unstable_incrementalResolution: false,
useWatchman: true,
requireCycleIgnorePatterns: [/(^|\/|\\)node_modules($|\/|\\)/],
unstable_forceFullRefreshPatterns: [],
},
serializer: {
polyfillModuleNames: [],
getRunModuleStatement: (moduleId: number | string, globalPrefix: string) =>
`__r(${JSON.stringify(moduleId)});`,
getPolyfills: () => [],
getModulesRunBeforeMainModule: () => [],
processModuleFilter: module => true,
createModuleIdFactory: defaultCreateModuleIdFactory,
experimentalSerializerHook: () => {},
customSerializer: null,
isThirdPartyModule: module =>
/(?:^|[/\\])node_modules[/\\]/.test(module.path),
},
server: {
enhanceMiddleware: (middleware, _) => middleware,
forwardClientLogs: true,
port: 8081,
rewriteRequestUrl: url => url,
unstable_serverRoot: null,
useGlobalHotkey: true,
verifyConnections: false,
tls: false,
},
symbolicator: {
customizeFrame: () => {},
customizeStack: async (stack, _) => stack,
},
transformer: {
assetPlugins: [],
asyncRequireModulePath: 'metro-runtime/src/modules/asyncRequire',
assetRegistryPath: 'missing-asset-registry-path',
babelTransformerPath: 'metro-babel-transformer',
dynamicDepsInPackages: 'throwAtRuntime',
enableBabelRCLookup: true,
enableBabelRuntime: true,
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
preloadedModules: false,
ramGroups: [],
}),
globalPrefix: '',
hermesParser: false,
minifierConfig: {
mangle: {
toplevel: false,
},
output: {
ascii_only: true,
quote_style: 3,
wrap_iife: true,
},
sourceMap: {
includeSources: false,
},
toplevel: false,
compress: {
// reduce_funcs inlines single-use functions, which cause perf regressions.
reduce_funcs: false,
},
},
minifierPath: DEFAULT_METRO_MINIFIER_PATH,
optimizationSizeLimit: 150 * 1024, // 150 KiB.
transformVariants: {default: {}},
publicPath: '/assets',
allowOptionalDependencies: false,
unstable_allowRequireContext: false,
unstable_dependencyMapReservedName: null,
unstable_disableModuleWrapping: false,
unstable_disableNormalizePseudoGlobals: false,
unstable_renameRequire: true,
unstable_compactOutput: false,
unstable_memoizeInlineRequires: false,
unstable_workerThreads: false,
},
watcher: {
additionalExts,
healthCheck: {
enabled: false,
filePrefix: '.metro-health-check',
interval: 30000,
timeout: 5000,
},
unstable_lazySha1: true,
unstable_autoSaveCache: {
enabled: true,
debounceMs: 5000,
},
watchman: {
deferStates: ['hg.update'],
},
},
cacheStores: [
new FileStore({
root: path.join(os.tmpdir(), 'metro-cache'),
}),
],
cacheVersion: '1.0',
// We assume the default project path is two levels up from
// node_modules/metro/
projectRoot: projectRoot || path.resolve(__dirname, '../../..'),
stickyWorkers: true,
watchFolders: [],
transformerPath: 'metro-transform-worker',
maxWorkers: getMaxWorkers(),
resetCache: false,
reporter: new TerminalReporter(new Terminal(process.stdout)),
unstable_perfLoggerFactory: noopPerfLoggerFactory,
});
async function getDefaultConfig(rootPath: ?string): Promise<ConfigT> {
// We can add more logic here to get a sensible default configuration, for
// now we just return a stub.
return getDefaultValues(rootPath);
}
getDefaultConfig.getDefaultValues = getDefaultValues;
export default getDefaultConfig as interface {
(rootPath?: string): Promise<ConfigT>,
getDefaultValues: (rootPath?: string) => ConfigT,
};

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<4c43a8477da1248f0dfecc75159d2fe5>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-config/src/defaults/validConfig.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
import type {InputConfigT} from '../types';
declare function validConfig(): Promise<InputConfigT>;
export default validConfig;

36
node_modules/metro-config/src/defaults/validConfig.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = validConfig;
async function validConfig() {
const defaultConfig = await require("./index").default("/path/to/project");
const validConfig = {
...defaultConfig,
resolver: {
...defaultConfig.resolver,
resolveRequest: function CustomResolver() {
throw new Error("Not implemented");
},
hasteImplModulePath: "./path",
},
server: {
...defaultConfig.server,
unstable_serverRoot: "",
},
transformer: {
...defaultConfig.transformer,
getTransformOptions: function getTransformOptions() {
throw new Error("Not implemented");
},
},
serializer: {
...defaultConfig.serializer,
customSerializer: function customSerializer() {
throw new Error("Not implemented");
},
},
};
return validConfig;
}

View File

@@ -0,0 +1,44 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
* @oncall react_native
*/
import type {InputConfigT} from '../types';
export default async function validConfig(): Promise<InputConfigT> {
const defaultConfig = await require('./index').default('/path/to/project');
const validConfig = {
...defaultConfig,
resolver: {
...defaultConfig.resolver,
resolveRequest: function CustomResolver() {
throw new Error('Not implemented');
},
hasteImplModulePath: './path',
},
server: {
...defaultConfig.server,
unstable_serverRoot: '',
},
transformer: {
...defaultConfig.transformer,
getTransformOptions: function getTransformOptions() {
throw new Error('Not implemented');
},
},
serializer: {
...defaultConfig.serializer,
customSerializer: function customSerializer() {
throw new Error('Not implemented');
},
},
};
return validConfig;
}