metro-transform-worker 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.
- package/package.json +8 -8
- package/src/index.d.ts +124 -0
- package/src/utils/assetTransformer.d.ts +25 -0
- package/src/utils/getMinifier.d.ts +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro-transform-worker",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.2",
|
|
4
4
|
"description": "🚇 Transform worker for Metro.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"@babel/parser": "^7.29.0",
|
|
25
25
|
"@babel/types": "^7.29.0",
|
|
26
26
|
"flow-enums-runtime": "^0.0.6",
|
|
27
|
-
"metro": "0.84.
|
|
28
|
-
"metro-babel-transformer": "0.84.
|
|
29
|
-
"metro-cache": "0.84.
|
|
30
|
-
"metro-cache-key": "0.84.
|
|
31
|
-
"metro-minify-terser": "0.84.
|
|
32
|
-
"metro-source-map": "0.84.
|
|
33
|
-
"metro-transform-plugins": "0.84.
|
|
27
|
+
"metro": "0.84.2",
|
|
28
|
+
"metro-babel-transformer": "0.84.2",
|
|
29
|
+
"metro-cache": "0.84.2",
|
|
30
|
+
"metro-cache-key": "0.84.2",
|
|
31
|
+
"metro-minify-terser": "0.84.2",
|
|
32
|
+
"metro-source-map": "0.84.2",
|
|
33
|
+
"metro-transform-plugins": "0.84.2",
|
|
34
34
|
"nullthrows": "^1.1.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
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<<a9f82c31a355f3717a1bad9c405ed305>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-transform-worker/src/index.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 {
|
|
19
|
+
CustomTransformOptions,
|
|
20
|
+
TransformProfile,
|
|
21
|
+
} from 'metro-babel-transformer';
|
|
22
|
+
import type {
|
|
23
|
+
BasicSourceMap,
|
|
24
|
+
FBSourceFunctionMap,
|
|
25
|
+
MetroSourceMapSegmentTuple,
|
|
26
|
+
} from 'metro-source-map';
|
|
27
|
+
import type {TransformResultDependency} from 'metro/private/DeltaBundler';
|
|
28
|
+
import type {AllowOptionalDependencies} from 'metro/private/DeltaBundler/types';
|
|
29
|
+
import type {DynamicRequiresBehavior} from 'metro/private/ModuleGraph/worker/collectDependencies';
|
|
30
|
+
|
|
31
|
+
type MinifierConfig = Readonly<{[$$Key$$: string]: unknown}>;
|
|
32
|
+
export type MinifierOptions = {
|
|
33
|
+
code: string;
|
|
34
|
+
map: null | undefined | BasicSourceMap;
|
|
35
|
+
filename: string;
|
|
36
|
+
reserved: ReadonlyArray<string>;
|
|
37
|
+
config: MinifierConfig;
|
|
38
|
+
};
|
|
39
|
+
export type MinifierResult = {code: string; map?: BasicSourceMap};
|
|
40
|
+
export type Minifier = (
|
|
41
|
+
$$PARAM_0$$: MinifierOptions,
|
|
42
|
+
) => MinifierResult | Promise<MinifierResult>;
|
|
43
|
+
export type Type = 'script' | 'module' | 'asset';
|
|
44
|
+
export type JsTransformerConfig = Readonly<{
|
|
45
|
+
assetPlugins: ReadonlyArray<string>;
|
|
46
|
+
assetRegistryPath: string;
|
|
47
|
+
asyncRequireModulePath: string;
|
|
48
|
+
babelTransformerPath: string;
|
|
49
|
+
dynamicDepsInPackages: DynamicRequiresBehavior;
|
|
50
|
+
enableBabelRCLookup: boolean;
|
|
51
|
+
enableBabelRuntime: boolean | string;
|
|
52
|
+
globalPrefix: string;
|
|
53
|
+
hermesParser: boolean;
|
|
54
|
+
minifierConfig: MinifierConfig;
|
|
55
|
+
minifierPath: string;
|
|
56
|
+
optimizationSizeLimit: number;
|
|
57
|
+
publicPath: string;
|
|
58
|
+
allowOptionalDependencies: AllowOptionalDependencies;
|
|
59
|
+
unstable_dependencyMapReservedName: null | undefined | string;
|
|
60
|
+
unstable_disableModuleWrapping: boolean;
|
|
61
|
+
unstable_disableNormalizePseudoGlobals: boolean;
|
|
62
|
+
unstable_compactOutput: boolean;
|
|
63
|
+
/** Enable `require.context` statements which can be used to import multiple files in a directory. */
|
|
64
|
+
unstable_allowRequireContext: boolean;
|
|
65
|
+
/** With inlineRequires, enable a module-scope memo var and inline as (v || v=require('foo')) */
|
|
66
|
+
unstable_memoizeInlineRequires?: boolean;
|
|
67
|
+
/** With inlineRequires, do not memoize these module specifiers */
|
|
68
|
+
unstable_nonMemoizedInlineRequires?: ReadonlyArray<string>;
|
|
69
|
+
/** Whether to rename scoped `require` functions to `_$$_REQUIRE`, usually an extraneous operation when serializing to iife (default). */
|
|
70
|
+
unstable_renameRequire?: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
export type {CustomTransformOptions} from 'metro-babel-transformer';
|
|
73
|
+
export type JsTransformOptions = Readonly<{
|
|
74
|
+
customTransformOptions?: CustomTransformOptions;
|
|
75
|
+
dev: boolean;
|
|
76
|
+
experimentalImportSupport?: boolean;
|
|
77
|
+
inlinePlatform: boolean;
|
|
78
|
+
inlineRequires: boolean;
|
|
79
|
+
minify: boolean;
|
|
80
|
+
nonInlinedRequires?: ReadonlyArray<string>;
|
|
81
|
+
platform: null | undefined | string;
|
|
82
|
+
type: Type;
|
|
83
|
+
unstable_memoizeInlineRequires?: boolean;
|
|
84
|
+
unstable_nonMemoizedInlineRequires?: ReadonlyArray<string>;
|
|
85
|
+
unstable_staticHermesOptimizedRequire?: boolean;
|
|
86
|
+
unstable_transformProfile: TransformProfile;
|
|
87
|
+
}>;
|
|
88
|
+
type JSFileType = 'js/script' | 'js/module' | 'js/module/asset';
|
|
89
|
+
export type JsOutput = Readonly<{
|
|
90
|
+
data: Readonly<{
|
|
91
|
+
code: string;
|
|
92
|
+
lineCount: number;
|
|
93
|
+
map: Array<MetroSourceMapSegmentTuple>;
|
|
94
|
+
functionMap: null | undefined | FBSourceFunctionMap;
|
|
95
|
+
}>;
|
|
96
|
+
type: JSFileType;
|
|
97
|
+
}>;
|
|
98
|
+
type TransformResponse = Readonly<{
|
|
99
|
+
dependencies: ReadonlyArray<TransformResultDependency>;
|
|
100
|
+
output: ReadonlyArray<JsOutput>;
|
|
101
|
+
}>;
|
|
102
|
+
export declare const transform: (
|
|
103
|
+
config: JsTransformerConfig,
|
|
104
|
+
projectRoot: string,
|
|
105
|
+
filename: string,
|
|
106
|
+
data: Buffer,
|
|
107
|
+
options: JsTransformOptions,
|
|
108
|
+
) => Promise<TransformResponse>;
|
|
109
|
+
export declare type transform = typeof transform;
|
|
110
|
+
export declare const getCacheKey: (config: JsTransformerConfig) => string;
|
|
111
|
+
export declare type getCacheKey = typeof getCacheKey;
|
|
112
|
+
/**
|
|
113
|
+
* Backwards-compatibility with CommonJS consumers using interopRequireDefault.
|
|
114
|
+
* Do not add to this list.
|
|
115
|
+
*
|
|
116
|
+
* @deprecated Default import from 'metro-transform-worker' is deprecated, use named exports.
|
|
117
|
+
*/
|
|
118
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: {
|
|
119
|
+
getCacheKey: typeof getCacheKey;
|
|
120
|
+
transform: typeof transform;
|
|
121
|
+
};
|
|
122
|
+
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
|
|
123
|
+
typeof $$EXPORT_DEFAULT_DECLARATION$$;
|
|
124
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
|
@@ -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<<b122890ad90539195b3a9805a1a7e02f>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-transform-worker/src/utils/assetTransformer.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 {File} from '@babel/types';
|
|
19
|
+
import type {BabelTransformerArgs} from 'metro-babel-transformer';
|
|
20
|
+
|
|
21
|
+
export declare function transform(
|
|
22
|
+
$$PARAM_0$$: BabelTransformerArgs,
|
|
23
|
+
assetRegistryPath: string,
|
|
24
|
+
assetDataPlugins: ReadonlyArray<string>,
|
|
25
|
+
): Promise<{ast: File}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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<<410ba17e82af72676f3993ebd1d0f60f>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-transform-worker/src/utils/getMinifier.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 {Minifier} from '../index.js';
|
|
19
|
+
|
|
20
|
+
declare function getMinifier(minifierPath: string): Minifier;
|
|
21
|
+
export default getMinifier;
|