metro 0.83.4 → 0.83.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -15
- package/src/Assets.d.ts +83 -0
- package/src/Assets.js +2 -9
- package/src/Bundler/util.d.ts +27 -0
- package/src/Bundler/util.js +2 -9
- package/src/Bundler.d.ts +38 -0
- package/src/Bundler.js +1 -5
- package/src/DeltaBundler/DeltaCalculator.d.ts +71 -0
- package/src/DeltaBundler/DeltaCalculator.js +1 -5
- package/src/DeltaBundler/Graph.d.ts +167 -0
- package/src/DeltaBundler/Graph.js +1 -5
- package/src/DeltaBundler/Serializers/baseJSBundle.d.ts +20 -0
- package/src/DeltaBundler/Serializers/baseJSBundle.js +1 -5
- package/src/DeltaBundler/Serializers/getAllFiles.d.ts +22 -0
- package/src/DeltaBundler/Serializers/getAssets.d.ts +25 -0
- package/src/DeltaBundler/Serializers/getAssets.js +1 -5
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.d.ts +26 -0
- package/src/DeltaBundler/Serializers/getRamBundleInfo.d.ts +48 -0
- package/src/DeltaBundler/Serializers/getRamBundleInfo.js +1 -5
- package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.d.ts +12 -0
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.d.ts +33 -0
- package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.d.ts +17 -0
- package/src/DeltaBundler/Serializers/helpers/js.d.ts +30 -0
- package/src/DeltaBundler/Serializers/helpers/js.js +2 -9
- package/src/DeltaBundler/Serializers/helpers/processModules.d.ts +25 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.d.ts +30 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +2 -9
- package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +29 -0
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js +1 -5
- package/src/DeltaBundler/Serializers/sourceMapObject.d.ts +23 -0
- package/src/DeltaBundler/Serializers/sourceMapString.d.ts +22 -0
- package/src/DeltaBundler/Transformer.d.ts +38 -0
- package/src/DeltaBundler/Transformer.js +1 -5
- package/src/DeltaBundler/Worker.d.ts +37 -0
- package/src/DeltaBundler/Worker.flow.js +1 -5
- package/src/DeltaBundler/WorkerFarm.d.ts +70 -0
- package/src/DeltaBundler/buildSubgraph.d.ts +30 -0
- package/src/DeltaBundler/buildSubgraph.js +1 -5
- package/src/DeltaBundler/getTransformCacheKey.d.ts +18 -0
- package/src/DeltaBundler/getTransformCacheKey.js +1 -5
- package/src/DeltaBundler/mergeDeltas.d.ts +17 -0
- package/src/DeltaBundler/types.d.ts +163 -0
- package/src/DeltaBundler/types.js +1 -5
- package/src/DeltaBundler.d.ts +60 -0
- package/src/DeltaBundler.js +1 -5
- package/src/HmrServer.d.ts +79 -0
- package/src/HmrServer.js +2 -9
- package/src/IncrementalBundler/GraphNotFoundError.d.ts +17 -0
- package/src/IncrementalBundler/ResourceNotFoundError.d.ts +15 -0
- package/src/IncrementalBundler/RevisionNotFoundError.d.ts +17 -0
- package/src/IncrementalBundler.d.ts +96 -0
- package/src/IncrementalBundler.js +2 -9
- package/src/ModuleGraph/worker/JsFileWrapping.d.ts +29 -0
- package/src/ModuleGraph/worker/JsFileWrapping.js +2 -9
- package/src/ModuleGraph/worker/collectDependencies.d.ts +131 -0
- package/src/ModuleGraph/worker/collectDependencies.js +2 -9
- package/src/ModuleGraph/worker/generateImportNames.d.ts +19 -0
- package/src/ModuleGraph/worker/generateImportNames.js +1 -5
- package/src/ModuleGraph/worker/importLocationsPlugin.d.ts +26 -0
- package/src/Server/MultipartResponse.d.ts +30 -0
- package/src/Server/MultipartResponse.js +1 -5
- package/src/Server/symbolicate.d.ts +31 -0
- package/src/Server.d.ts +271 -0
- package/src/Server.js +47 -15
- package/src/Server.js.flow +57 -10
- package/src/cli/parseKeyValueParamArray.d.ts +14 -0
- package/src/cli-utils.d.ts +19 -0
- package/src/cli-utils.js +1 -5
- package/src/commands/build.d.ts +16 -0
- package/src/commands/build.js +1 -5
- package/src/commands/dependencies.d.ts +16 -0
- package/src/commands/dependencies.js +1 -5
- package/src/commands/serve.d.ts +16 -0
- package/src/index.d.ts +180 -0
- package/src/index.flow.js +26 -19
- package/src/index.flow.js.flow +25 -10
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-import.js +1 -5
- package/src/integration_tests/basic_bundle/build-errors/inline-requires-cannot-resolve-import.js +1 -5
- package/src/integration_tests/basic_bundle/import-export/index.js +2 -9
- package/src/integration_tests/execBundle.js +1 -5
- package/src/lib/BatchProcessor.d.ts +54 -0
- package/src/lib/BatchProcessor.js +1 -5
- package/src/lib/CountingSet.d.ts +48 -0
- package/src/lib/JsonReporter.d.ts +37 -0
- package/src/lib/RamBundleParser.d.ts +29 -0
- package/src/lib/RamBundleParser.js +1 -5
- package/src/lib/TerminalReporter.d.ts +118 -0
- package/src/lib/TerminalReporter.js +8 -16
- package/src/lib/TerminalReporter.js.flow +6 -15
- package/src/lib/bundleProgressUtils.d.ts +26 -0
- package/src/lib/bundleProgressUtils.js +19 -0
- package/src/lib/bundleProgressUtils.js.flow +35 -0
- package/src/lib/bundleToString.d.ts +19 -0
- package/src/lib/contextModule.d.ts +33 -0
- package/src/lib/contextModule.js +1 -5
- package/src/lib/contextModuleTemplates.d.ts +25 -0
- package/src/lib/contextModuleTemplates.js +1 -4
- package/src/lib/countLines.d.ts +12 -0
- package/src/lib/createWebsocketServer.d.ts +43 -0
- package/src/lib/createWebsocketServer.js +1 -5
- package/src/lib/debounceAsyncQueue.d.ts +15 -0
- package/src/lib/formatBundlingError.d.ts +23 -0
- package/src/lib/formatBundlingError.js +1 -5
- package/src/lib/getAppendScripts.d.ts +31 -0
- package/src/lib/getAppendScripts.js +1 -5
- package/src/lib/getGraphId.d.ts +25 -0
- package/src/lib/getGraphId.js +1 -5
- package/src/lib/getPreludeCode.d.ts +18 -0
- package/src/lib/getPrependedScripts.d.ts +24 -0
- package/src/lib/getPrependedScripts.js +2 -9
- package/src/lib/isResolvedDependency.d.ts +15 -0
- package/src/lib/logToConsole.d.ts +19 -0
- package/src/lib/logToConsole.js +1 -5
- package/src/lib/parseBundleOptionsFromBundleRequestUrl.d.ts +17 -0
- package/src/lib/parseBundleOptionsFromBundleRequestUrl.js +2 -9
- package/src/lib/parseCustomResolverOptions.d.ts +16 -0
- package/src/lib/parseCustomTransformOptions.d.ts +16 -0
- package/src/lib/parseJsonBody.d.ts +27 -0
- package/src/lib/pathUtils.d.ts +14 -0
- package/src/lib/pathUtils.js +1 -4
- package/src/lib/relativizeSourceMap.d.ts +17 -0
- package/src/lib/relativizeSourceMap.js +1 -5
- package/src/lib/reporting.d.ts +128 -0
- package/src/lib/reporting.js +1 -5
- package/src/lib/splitBundleOptions.d.ts +16 -0
- package/src/lib/transformHelpers.d.ts +35 -0
- package/src/lib/transformHelpers.js +1 -5
- package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +126 -0
- package/src/node-haste/DependencyGraph/ModuleResolution.js +2 -9
- package/src/node-haste/DependencyGraph/createFileMap.d.ts +29 -0
- package/src/node-haste/DependencyGraph/createFileMap.js +2 -9
- package/src/node-haste/DependencyGraph.d.ts +86 -0
- package/src/node-haste/DependencyGraph.js +1 -5
- package/src/node-haste/Package.d.ts +21 -0
- package/src/node-haste/Package.js +1 -5
- package/src/node-haste/PackageCache.d.ts +34 -0
- package/src/node-haste/PackageCache.js +1 -5
- package/src/node-haste/lib/AssetPaths.d.ts +29 -0
- package/src/node-haste/lib/AssetPaths.js +1 -5
- package/src/node-haste/lib/parsePlatformFilePath.d.ts +25 -0
- package/src/node-haste/lib/parsePlatformFilePath.js +1 -5
- package/src/shared/output/RamBundle/as-assets.d.ts +25 -0
- package/src/shared/output/RamBundle/as-assets.js +1 -5
- package/src/shared/output/RamBundle/as-indexed-file.d.ts +38 -0
- package/src/shared/output/RamBundle/as-indexed-file.js +1 -5
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.d.ts +23 -0
- package/src/shared/output/RamBundle/magic-number.d.ts +14 -0
- package/src/shared/output/RamBundle/util.d.ts +41 -0
- package/src/shared/output/RamBundle/util.js +1 -5
- package/src/shared/output/RamBundle/write-sourcemap.d.ts +16 -0
- package/src/shared/output/RamBundle/write-sourcemap.js +1 -5
- package/src/shared/output/RamBundle.d.ts +26 -0
- package/src/shared/output/RamBundle.js +1 -5
- package/src/shared/output/bundle.d.ts +27 -0
- package/src/shared/output/bundle.flow.js +1 -5
- package/src/shared/output/meta.d.ts +15 -0
- package/src/shared/output/meta.js +1 -5
- package/src/shared/output/unbundle.d.ts +11 -0
- package/src/shared/output/writeFile.d.ts +16 -0
- package/src/shared/output/writeFile.js +1 -5
- package/src/shared/types.d.ts +145 -0
|
@@ -20,11 +20,7 @@ var _fs = _interopRequireDefault(require("fs"));
|
|
|
20
20
|
var _metroCore = require("metro-core");
|
|
21
21
|
var _serializeError = _interopRequireDefault(require("serialize-error"));
|
|
22
22
|
function _interopRequireDefault(e) {
|
|
23
|
-
return e && e.__esModule
|
|
24
|
-
? e
|
|
25
|
-
: {
|
|
26
|
-
default: e,
|
|
27
|
-
};
|
|
23
|
+
return e && e.__esModule ? e : { default: e };
|
|
28
24
|
}
|
|
29
25
|
function formatBundlingError(error) {
|
|
30
26
|
if (error instanceof _metroCore.AmbiguousModuleResolutionError) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {Module} from '../DeltaBundler';
|
|
12
|
+
|
|
13
|
+
type Options<T extends number | string> = Readonly<{
|
|
14
|
+
asyncRequireModulePath: string;
|
|
15
|
+
createModuleId: ($$PARAM_0$$: string) => T;
|
|
16
|
+
getRunModuleStatement: (moduleId: T, globalPrefix: string) => string;
|
|
17
|
+
globalPrefix: string;
|
|
18
|
+
inlineSourceMap: null | undefined | boolean;
|
|
19
|
+
runBeforeMainModule: ReadonlyArray<string>;
|
|
20
|
+
runModule: boolean;
|
|
21
|
+
shouldAddToIgnoreList: ($$PARAM_0$$: Module) => boolean;
|
|
22
|
+
sourceMapUrl: null | undefined | string;
|
|
23
|
+
sourceUrl: null | undefined | string;
|
|
24
|
+
getSourceUrl: null | undefined | (($$PARAM_0$$: Module) => string);
|
|
25
|
+
}>;
|
|
26
|
+
declare function getAppendScripts<T extends number | string>(
|
|
27
|
+
entryPoint: string,
|
|
28
|
+
modules: ReadonlyArray<Module>,
|
|
29
|
+
options: Options<T>,
|
|
30
|
+
): ReadonlyArray<Module>;
|
|
31
|
+
export default getAppendScripts;
|
|
@@ -12,11 +12,7 @@ var _CountingSet = _interopRequireDefault(require("./CountingSet"));
|
|
|
12
12
|
var _countLines = _interopRequireDefault(require("./countLines"));
|
|
13
13
|
var _nullthrows = _interopRequireDefault(require("nullthrows"));
|
|
14
14
|
function _interopRequireDefault(e) {
|
|
15
|
-
return e && e.__esModule
|
|
16
|
-
? e
|
|
17
|
-
: {
|
|
18
|
-
default: e,
|
|
19
|
-
};
|
|
15
|
+
return e && e.__esModule ? e : { default: e };
|
|
20
16
|
}
|
|
21
17
|
function getAppendScripts(entryPoint, modules, options) {
|
|
22
18
|
const output = [];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {TransformInputOptions} from '../DeltaBundler/types';
|
|
12
|
+
import type {ResolverInputOptions} from '../shared/types';
|
|
13
|
+
|
|
14
|
+
export declare type GraphId = string;
|
|
15
|
+
declare function getGraphId(
|
|
16
|
+
entryFile: string,
|
|
17
|
+
options: TransformInputOptions,
|
|
18
|
+
$$PARAM_2$$: Readonly<{
|
|
19
|
+
shallow: boolean;
|
|
20
|
+
lazy: boolean;
|
|
21
|
+
unstable_allowRequireContext: boolean;
|
|
22
|
+
resolverOptions: ResolverInputOptions;
|
|
23
|
+
}>,
|
|
24
|
+
): GraphId;
|
|
25
|
+
export default getGraphId;
|
package/src/lib/getGraphId.js
CHANGED
|
@@ -8,11 +8,7 @@ var _canonicalize = _interopRequireDefault(
|
|
|
8
8
|
require("metro-core/private/canonicalize"),
|
|
9
9
|
);
|
|
10
10
|
function _interopRequireDefault(e) {
|
|
11
|
-
return e && e.__esModule
|
|
12
|
-
? e
|
|
13
|
-
: {
|
|
14
|
-
default: e,
|
|
15
|
-
};
|
|
11
|
+
return e && e.__esModule ? e : { default: e };
|
|
16
12
|
}
|
|
17
13
|
function getGraphId(
|
|
18
14
|
entryFile,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare function getPreludeCode($$PARAM_0$$: {
|
|
12
|
+
readonly extraVars?: {[$$Key$$: string]: unknown};
|
|
13
|
+
readonly isDev: boolean;
|
|
14
|
+
readonly globalPrefix: string;
|
|
15
|
+
readonly requireCycleIgnorePatterns: ReadonlyArray<RegExp>;
|
|
16
|
+
readonly unstable_forceFullRefreshPatterns: ReadonlyArray<RegExp>;
|
|
17
|
+
}): string;
|
|
18
|
+
export default getPreludeCode;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type Bundler from '../Bundler';
|
|
12
|
+
import type {Module, default as DeltaBundler} from '../DeltaBundler';
|
|
13
|
+
import type {TransformInputOptions} from '../DeltaBundler/types';
|
|
14
|
+
import type {ResolverInputOptions} from '../shared/types';
|
|
15
|
+
import type {ConfigT} from 'metro-config';
|
|
16
|
+
|
|
17
|
+
declare function getPrependedScripts(
|
|
18
|
+
config: ConfigT,
|
|
19
|
+
options: Omit<TransformInputOptions, 'type'>,
|
|
20
|
+
resolverOptions: ResolverInputOptions,
|
|
21
|
+
bundler: Bundler,
|
|
22
|
+
deltaBundler: DeltaBundler,
|
|
23
|
+
): Promise<ReadonlyArray<Module>>;
|
|
24
|
+
export default getPrependedScripts;
|
|
@@ -19,10 +19,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
19
19
|
if (!t && e && e.__esModule) return e;
|
|
20
20
|
var o,
|
|
21
21
|
i,
|
|
22
|
-
f = {
|
|
23
|
-
__proto__: null,
|
|
24
|
-
default: e,
|
|
25
|
-
};
|
|
22
|
+
f = { __proto__: null, default: e };
|
|
26
23
|
if (null === e || ("object" != typeof e && "function" != typeof e))
|
|
27
24
|
return f;
|
|
28
25
|
if ((o = t ? n : r)) {
|
|
@@ -42,11 +39,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
42
39
|
})(e, t);
|
|
43
40
|
}
|
|
44
41
|
function _interopRequireDefault(e) {
|
|
45
|
-
return e && e.__esModule
|
|
46
|
-
? e
|
|
47
|
-
: {
|
|
48
|
-
default: e,
|
|
49
|
-
};
|
|
42
|
+
return e && e.__esModule ? e : { default: e };
|
|
50
43
|
}
|
|
51
44
|
async function getPrependedScripts(
|
|
52
45
|
config,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {Dependency, ResolvedDependency} from '../DeltaBundler/types';
|
|
12
|
+
|
|
13
|
+
export declare function isResolvedDependency(
|
|
14
|
+
dep: Dependency,
|
|
15
|
+
): dep is ResolvedDependency;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {Terminal} from 'metro-core';
|
|
11
|
+
|
|
12
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: (
|
|
13
|
+
terminal: Terminal,
|
|
14
|
+
level: string,
|
|
15
|
+
...data: Array<unknown>
|
|
16
|
+
) => void;
|
|
17
|
+
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
|
|
18
|
+
typeof $$EXPORT_DEFAULT_DECLARATION$$;
|
|
19
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
package/src/lib/logToConsole.js
CHANGED
|
@@ -7,11 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
8
|
var _util = _interopRequireDefault(require("util"));
|
|
9
9
|
function _interopRequireDefault(e) {
|
|
10
|
-
return e && e.__esModule
|
|
11
|
-
? e
|
|
12
|
-
: {
|
|
13
|
-
default: e,
|
|
14
|
-
};
|
|
10
|
+
return e && e.__esModule ? e : { default: e };
|
|
15
11
|
}
|
|
16
12
|
const groupStack = [];
|
|
17
13
|
let collapsedGuardTimer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {BundleOptions} from '../shared/types';
|
|
12
|
+
|
|
13
|
+
declare function parseBundleOptionsFromBundleRequestUrl(
|
|
14
|
+
rawNonJscSafeUrlEncodedUrl: string,
|
|
15
|
+
platforms: Set<string>,
|
|
16
|
+
): Omit<BundleOptions, keyof {bundleType: string}> & {bundleType: string};
|
|
17
|
+
export default parseBundleOptionsFromBundleRequestUrl;
|
|
@@ -24,10 +24,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
24
24
|
if (!t && e && e.__esModule) return e;
|
|
25
25
|
var o,
|
|
26
26
|
i,
|
|
27
|
-
f = {
|
|
28
|
-
__proto__: null,
|
|
29
|
-
default: e,
|
|
30
|
-
};
|
|
27
|
+
f = { __proto__: null, default: e };
|
|
31
28
|
if (null === e || ("object" != typeof e && "function" != typeof e))
|
|
32
29
|
return f;
|
|
33
30
|
if ((o = t ? n : r)) {
|
|
@@ -47,11 +44,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
47
44
|
})(e, t);
|
|
48
45
|
}
|
|
49
46
|
function _interopRequireDefault(e) {
|
|
50
|
-
return e && e.__esModule
|
|
51
|
-
? e
|
|
52
|
-
: {
|
|
53
|
-
default: e,
|
|
54
|
-
};
|
|
47
|
+
return e && e.__esModule ? e : { default: e };
|
|
55
48
|
}
|
|
56
49
|
const debug = require("debug")(
|
|
57
50
|
"Metro:Server:parseBundleOptionsFromBundleRequestUrl",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {CustomResolverOptions} from 'metro-resolver';
|
|
12
|
+
|
|
13
|
+
declare function parseCustomResolverOptions(
|
|
14
|
+
searchParams: URLSearchParams,
|
|
15
|
+
): CustomResolverOptions;
|
|
16
|
+
export default parseCustomResolverOptions;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {CustomTransformOptions} from 'metro-transform-worker';
|
|
12
|
+
|
|
13
|
+
declare function parseCustomTransformOptions(
|
|
14
|
+
searchParams: URLSearchParams,
|
|
15
|
+
): CustomTransformOptions;
|
|
16
|
+
export default parseCustomTransformOptions;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {IncomingMessage} from 'http';
|
|
12
|
+
|
|
13
|
+
export type JsonData =
|
|
14
|
+
| {[$$Key$$: string]: JsonData}
|
|
15
|
+
| Array<JsonData>
|
|
16
|
+
| string
|
|
17
|
+
| number
|
|
18
|
+
| boolean
|
|
19
|
+
| null;
|
|
20
|
+
/**
|
|
21
|
+
* Attempt to parse a request body as JSON.
|
|
22
|
+
*/
|
|
23
|
+
declare function parseJsonBody(
|
|
24
|
+
req: IncomingMessage,
|
|
25
|
+
options?: {strict?: boolean},
|
|
26
|
+
): Promise<JsonData>;
|
|
27
|
+
export default parseJsonBody;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export declare const normalizePathSeparatorsToPosix: (
|
|
11
|
+
$$PARAM_0$$: string,
|
|
12
|
+
) => string;
|
|
13
|
+
export declare type normalizePathSeparatorsToPosix =
|
|
14
|
+
typeof normalizePathSeparatorsToPosix;
|
package/src/lib/pathUtils.js
CHANGED
|
@@ -13,10 +13,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
13
13
|
if (!t && e && e.__esModule) return e;
|
|
14
14
|
var o,
|
|
15
15
|
i,
|
|
16
|
-
f = {
|
|
17
|
-
__proto__: null,
|
|
18
|
-
default: e,
|
|
19
|
-
};
|
|
16
|
+
f = { __proto__: null, default: e };
|
|
20
17
|
if (null === e || ("object" != typeof e && "function" != typeof e))
|
|
21
18
|
return f;
|
|
22
19
|
if ((o = t ? n : r)) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {MixedSourceMap} from 'metro-source-map';
|
|
12
|
+
|
|
13
|
+
declare function relativizeSourceMapInline(
|
|
14
|
+
sourceMap: MixedSourceMap,
|
|
15
|
+
sourcesRoot: string,
|
|
16
|
+
): void;
|
|
17
|
+
export default relativizeSourceMapInline;
|
|
@@ -6,11 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = relativizeSourceMapInline;
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
8
|
function _interopRequireDefault(e) {
|
|
9
|
-
return e && e.__esModule
|
|
10
|
-
? e
|
|
11
|
-
: {
|
|
12
|
-
default: e,
|
|
13
|
-
};
|
|
9
|
+
return e && e.__esModule ? e : { default: e };
|
|
14
10
|
}
|
|
15
11
|
function relativizeSourceMapInline(sourceMap, sourcesRoot) {
|
|
16
12
|
if (sourceMap.mappings === undefined) {
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {Terminal} from 'metro-core';
|
|
12
|
+
import type {HealthCheckResult, WatcherStatus} from 'metro-file-map';
|
|
13
|
+
import type {CustomResolverOptions} from 'metro-resolver';
|
|
14
|
+
import type {CustomTransformOptions} from 'metro-transform-worker';
|
|
15
|
+
|
|
16
|
+
export type BundleDetails = {
|
|
17
|
+
bundleType: string;
|
|
18
|
+
customResolverOptions: CustomResolverOptions;
|
|
19
|
+
customTransformOptions: CustomTransformOptions;
|
|
20
|
+
dev: boolean;
|
|
21
|
+
entryFile: string;
|
|
22
|
+
minify: boolean;
|
|
23
|
+
platform: null | undefined | string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A tagged union of all the actions that may happen and we may want to
|
|
27
|
+
* report to the tool user.
|
|
28
|
+
*/
|
|
29
|
+
export type ReportableEvent =
|
|
30
|
+
| {port: number; hasReducedPerformance: boolean; type: 'initialize_started'}
|
|
31
|
+
| {type: 'initialize_failed'; port: number; error: Error}
|
|
32
|
+
| {type: 'initialize_done'; port: number}
|
|
33
|
+
| {buildID: string; type: 'bundle_build_done'}
|
|
34
|
+
| {buildID: string; type: 'bundle_build_failed'}
|
|
35
|
+
| {type: 'bundle_save_log'; message: string}
|
|
36
|
+
| {
|
|
37
|
+
buildID: string;
|
|
38
|
+
bundleDetails: BundleDetails;
|
|
39
|
+
isPrefetch?: boolean;
|
|
40
|
+
type: 'bundle_build_started';
|
|
41
|
+
}
|
|
42
|
+
| {error: Error; type: 'bundling_error'}
|
|
43
|
+
| {type: 'dep_graph_loading'; hasReducedPerformance: boolean}
|
|
44
|
+
| {type: 'dep_graph_loaded'}
|
|
45
|
+
| {
|
|
46
|
+
buildID: string;
|
|
47
|
+
type: 'bundle_transform_progressed';
|
|
48
|
+
transformedFileCount: number;
|
|
49
|
+
totalFileCount: number;
|
|
50
|
+
}
|
|
51
|
+
| {type: 'cache_read_error'; error: Error}
|
|
52
|
+
| {type: 'cache_write_error'; error: Error}
|
|
53
|
+
| {type: 'transform_cache_reset'}
|
|
54
|
+
| {type: 'worker_stdout_chunk'; chunk: string}
|
|
55
|
+
| {type: 'worker_stderr_chunk'; chunk: string}
|
|
56
|
+
| {type: 'hmr_client_error'; error: Error}
|
|
57
|
+
| {
|
|
58
|
+
type: 'client_log';
|
|
59
|
+
level:
|
|
60
|
+
| 'trace'
|
|
61
|
+
| 'info'
|
|
62
|
+
| 'warn'
|
|
63
|
+
| 'log'
|
|
64
|
+
| 'group'
|
|
65
|
+
| 'groupCollapsed'
|
|
66
|
+
| 'groupEnd'
|
|
67
|
+
| 'debug';
|
|
68
|
+
data: Array<unknown>;
|
|
69
|
+
}
|
|
70
|
+
| {type: 'resolver_warning'; message: string}
|
|
71
|
+
| {type: 'server_listening'; port: number; address: string; family: string}
|
|
72
|
+
| {type: 'transformer_load_started'}
|
|
73
|
+
| {type: 'transformer_load_done'}
|
|
74
|
+
| {type: 'transformer_load_failed'; error: Error}
|
|
75
|
+
| {type: 'watcher_health_check_result'; result: HealthCheckResult}
|
|
76
|
+
| {type: 'watcher_status'; status: WatcherStatus};
|
|
77
|
+
/**
|
|
78
|
+
* Code across the application takes a reporter as an option and calls the
|
|
79
|
+
* update whenever one of the ReportableEvent happens. Code does not directly
|
|
80
|
+
* write to the standard output, because a build would be:
|
|
81
|
+
*
|
|
82
|
+
* 1. ad-hoc, embedded into another tool, in which case we do not want to
|
|
83
|
+
* pollute that tool's own output. The tool is free to present the
|
|
84
|
+
* warnings/progress we generate any way they want, by specifing a custom
|
|
85
|
+
* reporter.
|
|
86
|
+
* 2. run as a background process from another tool, in which case we want
|
|
87
|
+
* to expose updates in a way that is easily machine-readable, for example
|
|
88
|
+
* a JSON-stream. We don't want to pollute it with textual messages.
|
|
89
|
+
*
|
|
90
|
+
* We centralize terminal reporting into a single place because we want the
|
|
91
|
+
* output to be robust and consistent. The most common reporter is
|
|
92
|
+
* TerminalReporter, that should be the only place in the application should
|
|
93
|
+
* access the `terminal` module (nor the `console`).
|
|
94
|
+
*/
|
|
95
|
+
export type Reporter = {update(event: ReportableEvent): void};
|
|
96
|
+
/**
|
|
97
|
+
* A standard way to log a warning to the terminal. This should not be called
|
|
98
|
+
* from some arbitrary Metro logic, only from the reporters. Instead of
|
|
99
|
+
* calling this, add a new type of ReportableEvent instead, and implement a
|
|
100
|
+
* proper handler in the reporter(s).
|
|
101
|
+
*/
|
|
102
|
+
export declare function logWarning(
|
|
103
|
+
terminal: Terminal,
|
|
104
|
+
format: string,
|
|
105
|
+
...args: Array<unknown>
|
|
106
|
+
): void;
|
|
107
|
+
/**
|
|
108
|
+
* Similar to `logWarning`, but for messages that require the user to act.
|
|
109
|
+
*/
|
|
110
|
+
export declare function logError(
|
|
111
|
+
terminal: Terminal,
|
|
112
|
+
format: string,
|
|
113
|
+
...args: Array<unknown>
|
|
114
|
+
): void;
|
|
115
|
+
/**
|
|
116
|
+
* Similar to `logWarning`, but for informational messages.
|
|
117
|
+
*/
|
|
118
|
+
export declare function logInfo(
|
|
119
|
+
terminal: Terminal,
|
|
120
|
+
format: string,
|
|
121
|
+
...args: Array<unknown>
|
|
122
|
+
): void;
|
|
123
|
+
/**
|
|
124
|
+
* A reporter that does nothing. Errors and warnings will be swallowed, that
|
|
125
|
+
* is generally not what you want.
|
|
126
|
+
*/
|
|
127
|
+
export declare const nullReporter: {update(): void};
|
|
128
|
+
export declare type nullReporter = typeof nullReporter;
|
package/src/lib/reporting.js
CHANGED
|
@@ -10,11 +10,7 @@ exports.nullReporter = void 0;
|
|
|
10
10
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
11
|
var _util = _interopRequireDefault(require("util"));
|
|
12
12
|
function _interopRequireDefault(e) {
|
|
13
|
-
return e && e.__esModule
|
|
14
|
-
? e
|
|
15
|
-
: {
|
|
16
|
-
default: e,
|
|
17
|
-
};
|
|
13
|
+
return e && e.__esModule ? e : { default: e };
|
|
18
14
|
}
|
|
19
15
|
function logWarning(terminal, format, ...args) {
|
|
20
16
|
const str = _util.default.format(format, ...args);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {BundleOptions, SplitBundleOptions} from '../shared/types';
|
|
12
|
+
/**
|
|
13
|
+
* Splits a BundleOptions object into smaller, more manageable parts.
|
|
14
|
+
*/
|
|
15
|
+
declare function splitBundleOptions(options: BundleOptions): SplitBundleOptions;
|
|
16
|
+
export default splitBundleOptions;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type Bundler from '../Bundler';
|
|
12
|
+
import type {TransformFn, default as DeltaBundler} from '../DeltaBundler';
|
|
13
|
+
import type {
|
|
14
|
+
BundlerResolution,
|
|
15
|
+
TransformInputOptions,
|
|
16
|
+
TransformResultDependency,
|
|
17
|
+
} from '../DeltaBundler/types';
|
|
18
|
+
import type {ResolverInputOptions} from '../shared/types';
|
|
19
|
+
import type {ConfigT} from 'metro-config';
|
|
20
|
+
|
|
21
|
+
export declare function getTransformFn(
|
|
22
|
+
entryFiles: ReadonlyArray<string>,
|
|
23
|
+
bundler: Bundler,
|
|
24
|
+
deltaBundler: DeltaBundler,
|
|
25
|
+
config: ConfigT,
|
|
26
|
+
options: TransformInputOptions,
|
|
27
|
+
resolverOptions: ResolverInputOptions,
|
|
28
|
+
): Promise<TransformFn>;
|
|
29
|
+
export declare function getResolveDependencyFn(
|
|
30
|
+
bundler: Bundler,
|
|
31
|
+
platform: null | undefined | string,
|
|
32
|
+
resolverOptions: ResolverInputOptions,
|
|
33
|
+
): Promise<
|
|
34
|
+
(from: string, dependency: TransformResultDependency) => BundlerResolution
|
|
35
|
+
>;
|
|
@@ -10,11 +10,7 @@ var _isAssetFile = _interopRequireDefault(
|
|
|
10
10
|
require("metro-resolver/private/utils/isAssetFile"),
|
|
11
11
|
);
|
|
12
12
|
function _interopRequireDefault(e) {
|
|
13
|
-
return e && e.__esModule
|
|
14
|
-
? e
|
|
15
|
-
: {
|
|
16
|
-
default: e,
|
|
17
|
-
};
|
|
13
|
+
return e && e.__esModule ? e : { default: e };
|
|
18
14
|
}
|
|
19
15
|
const baseIgnoredInlineRequires = [
|
|
20
16
|
"React",
|