metro 0.84.0 → 0.84.2

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.
Files changed (101) hide show
  1. package/package.json +15 -14
  2. package/src/Assets.d.ts +90 -0
  3. package/src/Bundler/util.d.ts +34 -0
  4. package/src/Bundler.d.ts +45 -0
  5. package/src/DeltaBundler/DeltaCalculator.d.ts +78 -0
  6. package/src/DeltaBundler/Graph.d.ts +174 -0
  7. package/src/DeltaBundler/Serializers/baseJSBundle.d.ts +27 -0
  8. package/src/DeltaBundler/Serializers/getAllFiles.d.ts +29 -0
  9. package/src/DeltaBundler/Serializers/getAssets.d.ts +32 -0
  10. package/src/DeltaBundler/Serializers/getExplodedSourceMap.d.ts +33 -0
  11. package/src/DeltaBundler/Serializers/getRamBundleInfo.d.ts +55 -0
  12. package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.d.ts +19 -0
  13. package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.d.ts +40 -0
  14. package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.d.ts +24 -0
  15. package/src/DeltaBundler/Serializers/helpers/js.d.ts +37 -0
  16. package/src/DeltaBundler/Serializers/helpers/processModules.d.ts +32 -0
  17. package/src/DeltaBundler/Serializers/hmrJSBundle.d.ts +37 -0
  18. package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +36 -0
  19. package/src/DeltaBundler/Serializers/sourceMapObject.d.ts +30 -0
  20. package/src/DeltaBundler/Serializers/sourceMapString.d.ts +29 -0
  21. package/src/DeltaBundler/Transformer.d.ts +45 -0
  22. package/src/DeltaBundler/Worker.d.ts +44 -0
  23. package/src/DeltaBundler/WorkerFarm.d.ts +77 -0
  24. package/src/DeltaBundler/buildSubgraph.d.ts +37 -0
  25. package/src/DeltaBundler/getTransformCacheKey.d.ts +25 -0
  26. package/src/DeltaBundler/mergeDeltas.d.ts +24 -0
  27. package/src/DeltaBundler/types.d.ts +170 -0
  28. package/src/DeltaBundler.d.ts +67 -0
  29. package/src/HmrServer.d.ts +86 -0
  30. package/src/IncrementalBundler/GraphNotFoundError.d.ts +24 -0
  31. package/src/IncrementalBundler/ResourceNotFoundError.d.ts +22 -0
  32. package/src/IncrementalBundler/RevisionNotFoundError.d.ts +24 -0
  33. package/src/IncrementalBundler.d.ts +103 -0
  34. package/src/ModuleGraph/worker/JsFileWrapping.d.ts +36 -0
  35. package/src/ModuleGraph/worker/collectDependencies.d.ts +138 -0
  36. package/src/ModuleGraph/worker/generateImportNames.d.ts +26 -0
  37. package/src/ModuleGraph/worker/importLocationsPlugin.d.ts +33 -0
  38. package/src/Server/MultipartResponse.d.ts +37 -0
  39. package/src/Server/symbolicate.d.ts +38 -0
  40. package/src/Server.d.ts +278 -0
  41. package/src/Server.js +10 -6
  42. package/src/Server.js.flow +9 -10
  43. package/src/cli/parseKeyValueParamArray.d.ts +21 -0
  44. package/src/cli-utils.d.ts +26 -0
  45. package/src/commands/build.d.ts +23 -0
  46. package/src/commands/dependencies.d.ts +23 -0
  47. package/src/commands/serve.d.ts +23 -0
  48. package/src/index.d.ts +187 -0
  49. package/src/index.flow.js +24 -10
  50. package/src/index.flow.js.flow +25 -10
  51. package/src/lib/BatchProcessor.d.ts +61 -0
  52. package/src/lib/CountingSet.d.ts +55 -0
  53. package/src/lib/JsonReporter.d.ts +44 -0
  54. package/src/lib/RamBundleParser.d.ts +36 -0
  55. package/src/lib/TerminalReporter.d.ts +125 -0
  56. package/src/lib/TerminalReporter.js +6 -7
  57. package/src/lib/TerminalReporter.js.flow +6 -15
  58. package/src/lib/bundleProgressUtils.d.ts +33 -0
  59. package/src/lib/bundleProgressUtils.js +19 -0
  60. package/src/lib/bundleProgressUtils.js.flow +35 -0
  61. package/src/lib/bundleToString.d.ts +26 -0
  62. package/src/lib/contextModule.d.ts +40 -0
  63. package/src/lib/contextModuleTemplates.d.ts +32 -0
  64. package/src/lib/countLines.d.ts +19 -0
  65. package/src/lib/createWebsocketServer.d.ts +50 -0
  66. package/src/lib/debounceAsyncQueue.d.ts +22 -0
  67. package/src/lib/formatBundlingError.d.ts +30 -0
  68. package/src/lib/getAppendScripts.d.ts +38 -0
  69. package/src/lib/getGraphId.d.ts +32 -0
  70. package/src/lib/getPreludeCode.d.ts +25 -0
  71. package/src/lib/getPrependedScripts.d.ts +31 -0
  72. package/src/lib/isResolvedDependency.d.ts +22 -0
  73. package/src/lib/logToConsole.d.ts +26 -0
  74. package/src/lib/parseBundleOptionsFromBundleRequestUrl.d.ts +24 -0
  75. package/src/lib/parseCustomResolverOptions.d.ts +23 -0
  76. package/src/lib/parseCustomTransformOptions.d.ts +23 -0
  77. package/src/lib/parseJsonBody.d.ts +34 -0
  78. package/src/lib/pathUtils.d.ts +21 -0
  79. package/src/lib/relativizeSourceMap.d.ts +24 -0
  80. package/src/lib/reporting.d.ts +135 -0
  81. package/src/lib/splitBundleOptions.d.ts +23 -0
  82. package/src/lib/transformHelpers.d.ts +42 -0
  83. package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +133 -0
  84. package/src/node-haste/DependencyGraph/createFileMap.d.ts +36 -0
  85. package/src/node-haste/DependencyGraph.d.ts +93 -0
  86. package/src/node-haste/Package.d.ts +28 -0
  87. package/src/node-haste/PackageCache.d.ts +41 -0
  88. package/src/node-haste/lib/AssetPaths.d.ts +36 -0
  89. package/src/node-haste/lib/parsePlatformFilePath.d.ts +32 -0
  90. package/src/shared/output/RamBundle/as-assets.d.ts +32 -0
  91. package/src/shared/output/RamBundle/as-indexed-file.d.ts +45 -0
  92. package/src/shared/output/RamBundle/buildSourcemapWithMetadata.d.ts +30 -0
  93. package/src/shared/output/RamBundle/magic-number.d.ts +21 -0
  94. package/src/shared/output/RamBundle/util.d.ts +48 -0
  95. package/src/shared/output/RamBundle/write-sourcemap.d.ts +23 -0
  96. package/src/shared/output/RamBundle.d.ts +33 -0
  97. package/src/shared/output/bundle.d.ts +34 -0
  98. package/src/shared/output/meta.d.ts +22 -0
  99. package/src/shared/output/unbundle.d.ts +18 -0
  100. package/src/shared/output/writeFile.d.ts +23 -0
  101. package/src/shared/types.d.ts +152 -0
@@ -0,0 +1,40 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<cd7e523b4fdfbff33e663b21c4529401>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module} from '../../types';
19
+ import type {
20
+ FBSourceFunctionMap,
21
+ MetroSourceMapSegmentTuple,
22
+ } from 'metro-source-map';
23
+
24
+ declare function getSourceMapInfo(
25
+ module: Module,
26
+ options: {
27
+ readonly excludeSource: boolean;
28
+ readonly shouldAddToIgnoreList: ($$PARAM_0$$: Module) => boolean;
29
+ getSourceUrl: null | undefined | ((module: Module) => string);
30
+ },
31
+ ): {
32
+ readonly map: Array<MetroSourceMapSegmentTuple>;
33
+ readonly functionMap: null | undefined | FBSourceFunctionMap;
34
+ readonly code: string;
35
+ readonly path: string;
36
+ readonly source: string;
37
+ readonly lineCount: number;
38
+ readonly isIgnored: boolean;
39
+ };
40
+ export default getSourceMapInfo;
@@ -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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<55bd91c160900bb31ffe72e2ddfad85d>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {ReadOnlyGraph} from '../../types';
19
+
20
+ declare function getTransitiveDependencies<T>(
21
+ path: string,
22
+ graph: ReadOnlyGraph<T>,
23
+ ): Set<string>;
24
+ export default getTransitiveDependencies;
@@ -0,0 +1,37 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<f61e17deebe7e34585ad214ae287e704>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/helpers/js.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {MixedOutput, Module} from '../../types';
19
+ import type {JsOutput} from 'metro-transform-worker';
20
+
21
+ export type Options = Readonly<{
22
+ createModuleId: ($$PARAM_0$$: string) => number | string;
23
+ dev: boolean;
24
+ includeAsyncPaths: boolean;
25
+ projectRoot: string;
26
+ serverRoot: string;
27
+ sourceUrl: null | undefined | string;
28
+ }>;
29
+ export declare function wrapModule(module: Module, options: Options): string;
30
+ export declare function getModuleParams(
31
+ module: Module,
32
+ options: Options,
33
+ ): Array<unknown>;
34
+ export declare function getJsOutput(
35
+ module: Readonly<{output: ReadonlyArray<MixedOutput>; path?: string}>,
36
+ ): JsOutput;
37
+ export declare function isJsModule(module: Module): boolean;
@@ -0,0 +1,32 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<1c5fe56fba9dbedcde1dbaeb5a486467>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/helpers/processModules.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module} from '../../types';
19
+
20
+ declare function processModules(
21
+ modules: ReadonlyArray<Module>,
22
+ $$PARAM_1$$: Readonly<{
23
+ filter?: (module: Module) => boolean;
24
+ createModuleId: ($$PARAM_0$$: string) => number;
25
+ dev: boolean;
26
+ includeAsyncPaths: boolean;
27
+ projectRoot: string;
28
+ serverRoot: string;
29
+ sourceUrl: null | undefined | string;
30
+ }>,
31
+ ): ReadonlyArray<[Module, string]>;
32
+ export default processModules;
@@ -0,0 +1,37 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<d8ccae61344526a4f6da61987b3dad9b>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/hmrJSBundle.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {DeltaResult, ReadOnlyGraph} from '../types';
19
+ import type {HmrModule} from 'metro-runtime/src/modules/types';
20
+
21
+ type Options = Readonly<{
22
+ clientUrl: URL;
23
+ createModuleId: ($$PARAM_0$$: string) => number;
24
+ includeAsyncPaths: boolean;
25
+ projectRoot: string;
26
+ serverRoot: string;
27
+ }>;
28
+ declare function hmrJSBundle(
29
+ delta: DeltaResult,
30
+ graph: ReadOnlyGraph,
31
+ options: Options,
32
+ ): {
33
+ readonly added: ReadonlyArray<HmrModule>;
34
+ readonly deleted: ReadonlyArray<number>;
35
+ readonly modified: ReadonlyArray<HmrModule>;
36
+ };
37
+ export default hmrJSBundle;
@@ -0,0 +1,36 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<49bc83c20821024a7b77f5d5c3168d62>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module} from '../types';
19
+
20
+ import {fromRawMappings, fromRawMappingsNonBlocking} from 'metro-source-map';
21
+
22
+ export type SourceMapGeneratorOptions = Readonly<{
23
+ excludeSource: boolean;
24
+ processModuleFilter: (module: Module) => boolean;
25
+ shouldAddToIgnoreList: (module: Module) => boolean;
26
+ getSourceUrl: null | undefined | ((module: Module) => string);
27
+ }>;
28
+ declare function sourceMapGenerator(
29
+ modules: ReadonlyArray<Module>,
30
+ options: SourceMapGeneratorOptions,
31
+ ): ReturnType<typeof fromRawMappings>;
32
+ declare function sourceMapGeneratorNonBlocking(
33
+ modules: ReadonlyArray<Module>,
34
+ options: SourceMapGeneratorOptions,
35
+ ): ReturnType<typeof fromRawMappingsNonBlocking>;
36
+ export {sourceMapGenerator, sourceMapGeneratorNonBlocking};
@@ -0,0 +1,30 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<cb907f1a9aa40efd505a19826a21be6d>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/sourceMapObject.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module} from '../types';
19
+ import type {SourceMapGeneratorOptions} from './sourceMapGenerator';
20
+ import type {MixedSourceMap} from 'metro-source-map';
21
+
22
+ declare function sourceMapObject(
23
+ modules: ReadonlyArray<Module>,
24
+ options: SourceMapGeneratorOptions,
25
+ ): MixedSourceMap;
26
+ declare function sourceMapObjectNonBlocking(
27
+ modules: ReadonlyArray<Module>,
28
+ options: SourceMapGeneratorOptions,
29
+ ): Promise<MixedSourceMap>;
30
+ export {sourceMapObject, sourceMapObjectNonBlocking};
@@ -0,0 +1,29 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<578dd38524928420df15b0aba8f32e77>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/sourceMapString.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module} from '../types';
19
+ import type {SourceMapGeneratorOptions} from './sourceMapGenerator';
20
+
21
+ declare function sourceMapString(
22
+ modules: ReadonlyArray<Module>,
23
+ options: SourceMapGeneratorOptions,
24
+ ): string;
25
+ declare function sourceMapStringNonBlocking(
26
+ modules: ReadonlyArray<Module>,
27
+ options: SourceMapGeneratorOptions,
28
+ ): Promise<string>;
29
+ export {sourceMapString, sourceMapStringNonBlocking};
@@ -0,0 +1,45 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<15f603afc860c64c7acc5a6cfe2a6717>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Transformer.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {TransformResult, TransformResultWithSource} from '../DeltaBundler';
19
+ import type {TransformOptions} from './Worker';
20
+ import type {ConfigT} from 'metro-config';
21
+
22
+ import WorkerFarm from './WorkerFarm';
23
+ import {Cache} from 'metro-cache';
24
+
25
+ type GetOrComputeSha1Fn = (
26
+ $$PARAM_0$$: string,
27
+ ) => Promise<Readonly<{content?: Buffer; sha1: string}>>;
28
+ declare class Transformer {
29
+ _config: ConfigT;
30
+ _cache: Cache<TransformResult>;
31
+ _baseHash: string;
32
+ _getSha1: GetOrComputeSha1Fn;
33
+ _workerFarm: WorkerFarm;
34
+ constructor(
35
+ config: ConfigT,
36
+ opts: Readonly<{getOrComputeSha1: GetOrComputeSha1Fn}>,
37
+ );
38
+ transformFile(
39
+ filePath: string,
40
+ transformerOptions: TransformOptions,
41
+ fileBuffer?: Buffer,
42
+ ): Promise<TransformResultWithSource>;
43
+ end(): Promise<void>;
44
+ }
45
+ export default Transformer;
@@ -0,0 +1,44 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<36640ae81894592fbdc160fac081bdbf>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Worker.flow.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {TransformResult} from './types';
19
+ import type {LogEntry} from 'metro-core/private/Logger';
20
+ import type {
21
+ JsTransformerConfig,
22
+ JsTransformOptions,
23
+ } from 'metro-transform-worker';
24
+
25
+ export type {JsTransformOptions as TransformOptions} from 'metro-transform-worker';
26
+ export type TransformerConfig = {
27
+ transformerPath: string;
28
+ transformerConfig: JsTransformerConfig;
29
+ };
30
+ type Data = Readonly<{
31
+ result: TransformResult;
32
+ sha1: string;
33
+ transformFileStartLogEntry: LogEntry;
34
+ transformFileEndLogEntry: LogEntry;
35
+ }>;
36
+ export declare const transform: (
37
+ filename: string,
38
+ transformOptions: JsTransformOptions,
39
+ projectRoot: string,
40
+ transformerConfig: TransformerConfig,
41
+ fileBuffer?: Buffer,
42
+ ) => Promise<Data>;
43
+ export declare type transform = typeof transform;
44
+ export type Worker = {readonly transform: typeof transform};
@@ -0,0 +1,77 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<bbd52f1dc5e4a9253455034b585115ac>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/WorkerFarm.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {TransformResult} from '../DeltaBundler';
19
+ import type {TransformerConfig, TransformOptions, Worker} from './Worker';
20
+ import type {ConfigT} from 'metro-config';
21
+ import type {Readable} from 'stream';
22
+
23
+ type WorkerInterface = Readonly<
24
+ Omit<
25
+ Worker,
26
+ keyof {
27
+ end(): void | Promise<void>;
28
+ getStdout(): Readable;
29
+ getStderr(): Readable;
30
+ }
31
+ > & {
32
+ end(): void | Promise<void>;
33
+ getStdout(): Readable;
34
+ getStderr(): Readable;
35
+ }
36
+ >;
37
+ type TransformerResult = Readonly<{result: TransformResult; sha1: string}>;
38
+ declare class WorkerFarm {
39
+ _config: ConfigT;
40
+ _transformerConfig: TransformerConfig;
41
+ _worker: WorkerInterface | Worker;
42
+ constructor(config: ConfigT, transformerConfig: TransformerConfig);
43
+ kill(): Promise<void>;
44
+ transform(
45
+ filename: string,
46
+ options: TransformOptions,
47
+ fileBuffer?: Buffer,
48
+ ): Promise<TransformerResult>;
49
+ _makeFarm(
50
+ absoluteWorkerPath: string,
51
+ exposedMethods: ReadonlyArray<string>,
52
+ numWorkers: number,
53
+ ): WorkerInterface;
54
+ _computeWorkerKey(
55
+ method: string,
56
+ filename: string,
57
+ ): null | undefined | string;
58
+ _formatGenericError(
59
+ err: Readonly<{message: string; stack?: string}>,
60
+ filename: string,
61
+ ): TransformError;
62
+ _formatBabelError(
63
+ err: Readonly<{
64
+ message: string;
65
+ stack?: string;
66
+ type?: string;
67
+ codeFrame?: unknown;
68
+ loc: {line?: number; column?: number};
69
+ }>,
70
+ filename: string,
71
+ ): TransformError;
72
+ }
73
+ export default WorkerFarm;
74
+ declare class TransformError extends SyntaxError {
75
+ type: string;
76
+ constructor(message: string);
77
+ }
@@ -0,0 +1,37 @@
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
+ * @noformat
8
+ * @generated SignedSource<<1e334cd36bb429700b82654f1ddab0a0>>
9
+ *
10
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
+ * Original file: packages/metro/src/DeltaBundler/buildSubgraph.js
12
+ * To regenerate, run:
13
+ * js1 build metro-ts-defs (internal) OR
14
+ * yarn run build-ts-defs (OSS)
15
+ */
16
+
17
+ import type {RequireContext} from '../lib/contextModule';
18
+ import type {
19
+ ModuleData,
20
+ ResolvedDependency,
21
+ ResolveFn,
22
+ TransformFn,
23
+ } from './types';
24
+
25
+ type Parameters<T> = Readonly<{
26
+ resolve: ResolveFn;
27
+ transform: TransformFn<T>;
28
+ shouldTraverse: ($$PARAM_0$$: ResolvedDependency) => boolean;
29
+ }>;
30
+ export declare function buildSubgraph<T>(
31
+ entryPaths: ReadonlySet<string>,
32
+ resolvedContexts: ReadonlyMap<string, null | undefined | RequireContext>,
33
+ $$PARAM_2$$: Parameters<T>,
34
+ ): Promise<{
35
+ moduleData: Map<string, ModuleData<T>>;
36
+ errors: Map<string, Error>;
37
+ }>;
@@ -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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<1a82c2238a94514c16e7bb93bf49d8c9>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/getTransformCacheKey.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {TransformerConfig} from './Worker';
19
+
20
+ declare function getTransformCacheKey(opts: {
21
+ readonly cacheVersion: string;
22
+ readonly projectRoot: string;
23
+ readonly transformerConfig: TransformerConfig;
24
+ }): string;
25
+ export default getTransformCacheKey;
@@ -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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<46981e9bc1ef3945b99b147cbdf9ec5d>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/mergeDeltas.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {DeltaBundle} from 'metro-runtime/src/modules/types';
19
+
20
+ declare function mergeDeltas(
21
+ delta1: DeltaBundle,
22
+ delta2: DeltaBundle,
23
+ ): DeltaBundle;
24
+ export default mergeDeltas;