metro-transform-worker 0.76.1 → 0.76.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro-transform-worker",
3
- "version": "0.76.1",
3
+ "version": "0.76.3",
4
4
  "description": "🚇 Transform worker for Metro.",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -18,18 +18,18 @@
18
18
  "@babel/parser": "^7.20.0",
19
19
  "@babel/types": "^7.20.0",
20
20
  "babel-preset-fbjs": "^3.4.0",
21
- "metro": "0.76.1",
22
- "metro-babel-transformer": "0.76.1",
23
- "metro-cache": "0.76.1",
24
- "metro-cache-key": "0.76.1",
25
- "metro-source-map": "0.76.1",
26
- "metro-transform-plugins": "0.76.1",
21
+ "metro": "0.76.3",
22
+ "metro-babel-transformer": "0.76.3",
23
+ "metro-cache": "0.76.3",
24
+ "metro-cache-key": "0.76.3",
25
+ "metro-source-map": "0.76.3",
26
+ "metro-transform-plugins": "0.76.3",
27
27
  "nullthrows": "^1.1.1"
28
28
  },
29
29
  "devDependencies": {
30
- "metro-memory-fs": "0.76.1",
31
- "metro-minify-terser": "0.76.1",
32
- "metro-react-native-babel-transformer": "0.76.1"
30
+ "metro-memory-fs": "0.76.3",
31
+ "metro-minify-terser": "0.76.3",
32
+ "metro-react-native-babel-transformer": "0.76.3"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=16"
package/src/index.d.ts CHANGED
@@ -9,8 +9,8 @@
9
9
  */
10
10
 
11
11
  import type {DynamicRequiresBehavior} from 'metro';
12
- import type {TransformResultDependency} from 'metro/DeltaBundler';
13
- import type {AllowOptionalDependencies} from 'metro/DeltaBundler/types';
12
+ import type {TransformResultDependency} from 'metro/src/DeltaBundler';
13
+ import type {AllowOptionalDependencies} from 'metro/src/DeltaBundler/types';
14
14
  import type {
15
15
  CustomTransformOptions,
16
16
  TransformProfile,
package/src/index.js CHANGED
@@ -151,7 +151,7 @@ async function transformJS(file, { config, options, projectRoot }) {
151
151
  babelrc: false,
152
152
  code: false,
153
153
  configFile: false,
154
- comments: false,
154
+ comments: true,
155
155
  filename: file.filename,
156
156
  plugins,
157
157
  sourceMaps: false,
@@ -173,7 +173,7 @@ async function transformJS(file, { config, options, projectRoot }) {
173
173
  babelrc: false,
174
174
  code: false,
175
175
  configFile: false,
176
- comments: false,
176
+ comments: true,
177
177
  filename: file.filename,
178
178
  plugins: [
179
179
  [metroTransformPlugins.constantFoldingPlugin, babelPluginOpts],
@@ -256,7 +256,7 @@ async function transformJS(file, { config, options, projectRoot }) {
256
256
  const result = generate(
257
257
  wrappedAst,
258
258
  {
259
- comments: false,
259
+ comments: true,
260
260
  compact: config.unstable_compactOutput,
261
261
  filename: file.filename,
262
262
  retainLines: false,
package/src/index.js.flow CHANGED
@@ -299,7 +299,7 @@ async function transformJS(
299
299
  babelrc: false,
300
300
  code: false,
301
301
  configFile: false,
302
- comments: false,
302
+ comments: true,
303
303
  filename: file.filename,
304
304
  plugins,
305
305
  sourceMaps: false,
@@ -322,7 +322,7 @@ async function transformJS(
322
322
  babelrc: false,
323
323
  code: false,
324
324
  configFile: false,
325
- comments: false,
325
+ comments: true,
326
326
  filename: file.filename,
327
327
  plugins: [
328
328
  [metroTransformPlugins.constantFoldingPlugin, babelPluginOpts],
@@ -407,7 +407,7 @@ async function transformJS(
407
407
  const result = generate(
408
408
  wrappedAst,
409
409
  {
410
- comments: false,
410
+ comments: true,
411
411
  compact: config.unstable_compactOutput,
412
412
  filename: file.filename,
413
413
  retainLines: false,
package/types/index.d.ts DELETED
@@ -1,120 +0,0 @@
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 {DynamicRequiresBehavior} from 'metro';
12
- import type {TransformResultDependency} from 'metro/DeltaBundler';
13
- import type {AllowOptionalDependencies} from 'metro/DeltaBundler/types';
14
- import type {
15
- CustomTransformOptions,
16
- TransformProfile,
17
- } from 'metro-babel-transformer';
18
- import type {
19
- BasicSourceMap,
20
- FBSourceFunctionMap,
21
- MetroSourceMapSegmentTuple,
22
- } from 'metro-source-map';
23
-
24
- export type MinifierConfig = Readonly<Record<string, unknown>>;
25
-
26
- export interface MinifierOptions {
27
- code: string;
28
- map?: BasicSourceMap;
29
- filename: string;
30
- reserved: ReadonlyArray<string>;
31
- config: MinifierConfig;
32
- }
33
-
34
- export interface MinifierResult {
35
- code: string;
36
- map?: BasicSourceMap;
37
- }
38
-
39
- export type Minifier = (
40
- options: MinifierOptions,
41
- ) => MinifierResult | Promise<MinifierResult>;
42
-
43
- export type Type = 'script' | 'module' | 'asset';
44
-
45
- export type JsTransformerConfig = Readonly<{
46
- assetPlugins: ReadonlyArray<string>;
47
- assetRegistryPath: string;
48
- asyncRequireModulePath: string;
49
- babelTransformerPath: string;
50
- dynamicDepsInPackages: DynamicRequiresBehavior;
51
- enableBabelRCLookup: boolean;
52
- enableBabelRuntime: boolean;
53
- globalPrefix: string;
54
- hermesParser: boolean;
55
- minifierConfig: MinifierConfig;
56
- minifierPath: string;
57
- optimizationSizeLimit: number;
58
- publicPath: string;
59
- allowOptionalDependencies: AllowOptionalDependencies;
60
- unstable_collectDependenciesPath: string;
61
- unstable_dependencyMapReservedName?: string;
62
- unstable_disableModuleWrapping: boolean;
63
- unstable_disableNormalizePseudoGlobals: boolean;
64
- unstable_compactOutput: boolean;
65
- /** Enable `require.context` statements which can be used to import multiple files in a directory. */
66
- unstable_allowRequireContext: boolean;
67
- }>;
68
-
69
- export {CustomTransformOptions} from 'metro-babel-transformer';
70
-
71
- export type JsTransformOptions = Readonly<{
72
- customTransformOptions?: CustomTransformOptions;
73
- dev: boolean;
74
- experimentalImportSupport?: boolean;
75
- hot: boolean;
76
- inlinePlatform: boolean;
77
- inlineRequires: boolean;
78
- minify: boolean;
79
- nonInlinedRequires?: ReadonlyArray<string>;
80
- platform?: string;
81
- runtimeBytecodeVersion?: number;
82
- type: Type;
83
- unstable_disableES6Transforms?: boolean;
84
- unstable_transformProfile: TransformProfile;
85
- }>;
86
-
87
- export type BytecodeFileType =
88
- | 'bytecode/module'
89
- | 'bytecode/module/asset'
90
- | 'bytecode/script';
91
-
92
- export type JSFileType = 'js/script' | 'js/module' | 'js/module/asset';
93
-
94
- export type JsOutput = Readonly<{
95
- data: Readonly<{
96
- code: string;
97
- lineCount: number;
98
- map: MetroSourceMapSegmentTuple[];
99
- functionMap: FBSourceFunctionMap | null;
100
- }>;
101
- type: JSFileType;
102
- }>;
103
-
104
- // Hermes byte-code output type
105
- export type BytecodeOutput = unknown;
106
-
107
- export type TransformResponse = Readonly<{
108
- dependencies: ReadonlyArray<TransformResultDependency>;
109
- output: ReadonlyArray<JsOutput | BytecodeOutput>;
110
- }>;
111
-
112
- export function transform(
113
- config: JsTransformerConfig,
114
- projectRoot: string,
115
- filename: string,
116
- data: Buffer,
117
- options: JsTransformOptions,
118
- ): Promise<TransformResponse>;
119
-
120
- export function getCacheKey(config: JsTransformerConfig): string;