metro-transform-worker
Advanced tools
+8
-8
| { | ||
| "name": "metro-transform-worker", | ||
| "version": "0.85.0", | ||
| "version": "0.86.0", | ||
| "description": "🚇 Transform worker for Metro.", | ||
@@ -27,9 +27,9 @@ "main": "src/index.js", | ||
| "flow-enums-runtime": "^0.0.6", | ||
| "metro": "0.85.0", | ||
| "metro-babel-transformer": "0.85.0", | ||
| "metro-cache": "0.85.0", | ||
| "metro-cache-key": "0.85.0", | ||
| "metro-minify-terser": "0.85.0", | ||
| "metro-source-map": "0.85.0", | ||
| "metro-transform-plugins": "0.85.0", | ||
| "metro": "0.86.0", | ||
| "metro-babel-transformer": "0.86.0", | ||
| "metro-cache": "0.86.0", | ||
| "metro-cache-key": "0.86.0", | ||
| "metro-minify-terser": "0.86.0", | ||
| "metro-source-map": "0.86.0", | ||
| "metro-transform-plugins": "0.86.0", | ||
| "nullthrows": "^1.1.1" | ||
@@ -36,0 +36,0 @@ }, |
+3
-16
@@ -9,3 +9,3 @@ /** | ||
| * @oncall react_native | ||
| * @generated SignedSource<<165882da0b131608da36b1cbd00ecf28>> | ||
| * @generated SignedSource<<28342f12ccdb6543eff2ef94ebd19bbc>> | ||
| * | ||
@@ -26,3 +26,3 @@ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| FBSourceFunctionMap, | ||
| MetroSourceMapSegmentTuple, | ||
| VlqMap, | ||
| } from 'metro-source-map'; | ||
@@ -95,3 +95,3 @@ import type {TransformResultDependency} from 'metro/private/DeltaBundler'; | ||
| lineCount: number; | ||
| map: Array<MetroSourceMapSegmentTuple>; | ||
| map: VlqMap; | ||
| functionMap: null | undefined | FBSourceFunctionMap; | ||
@@ -118,14 +118,1 @@ }>; | ||
| export declare type getCacheKey = typeof getCacheKey; | ||
| /** | ||
| * Backwards-compatibility with CommonJS consumers using interopRequireDefault. | ||
| * Do not add to this list. | ||
| * | ||
| * @deprecated Default import from 'metro-transform-worker' is deprecated, use named exports. | ||
| */ | ||
| declare const $$EXPORT_DEFAULT_DECLARATION$$: { | ||
| getCacheKey: typeof getCacheKey; | ||
| transform: typeof transform; | ||
| }; | ||
| declare type $$EXPORT_DEFAULT_DECLARATION$$ = | ||
| typeof $$EXPORT_DEFAULT_DECLARATION$$; | ||
| export default $$EXPORT_DEFAULT_DECLARATION$$; |
+31
-16
@@ -6,3 +6,3 @@ "use strict"; | ||
| }); | ||
| exports.transform = exports.getCacheKey = exports.default = void 0; | ||
| exports.transform = exports.getCacheKey = void 0; | ||
| var assetTransformer = _interopRequireWildcard( | ||
@@ -304,8 +304,10 @@ require("./utils/assetTransformer"), | ||
| ); | ||
| let map = result.rawMappings | ||
| ? result.rawMappings.map(_metroSourceMap.toSegmentTuple) | ||
| : []; | ||
| let code = result.code; | ||
| let map; | ||
| let lineCount; | ||
| if (minify) { | ||
| ({ map, code } = await minifyCode( | ||
| let tuples = result.decodedMap | ||
| ? (0, _metroSourceMap.tuplesFromBabelDecodedMap)(result.decodedMap) | ||
| : []; | ||
| ({ map: tuples, code } = await minifyCode( | ||
| config, | ||
@@ -316,8 +318,18 @@ projectRoot, | ||
| file.code, | ||
| map, | ||
| tuples, | ||
| reserved, | ||
| )); | ||
| ({ lineCount, map: tuples } = countLinesAndTerminateMap(code, tuples)); | ||
| map = (0, _metroSourceMap.vlqMapFromTuples)(tuples); | ||
| } else { | ||
| const { lineCount: lines, lastLineColumn } = countLines(code); | ||
| lineCount = lines; | ||
| map = (0, _metroSourceMap.vlqMapFromBabelDecodedMap)( | ||
| result.decodedMap ?? { | ||
| mappings: [], | ||
| names: [], | ||
| }, | ||
| [lines, lastLineColumn], | ||
| ); | ||
| } | ||
| let lineCount; | ||
| ({ lineCount, map } = countLinesAndTerminateMap(code, map)); | ||
| const output = [ | ||
@@ -414,2 +426,3 @@ { | ||
| ({ lineCount, map } = countLinesAndTerminateMap(code, map)); | ||
| const outputMap = (0, _metroSourceMap.vlqMapFromTuples)(map); | ||
| const output = [ | ||
@@ -421,3 +434,3 @@ { | ||
| lineCount, | ||
| map, | ||
| map: outputMap, | ||
| }, | ||
@@ -535,3 +548,3 @@ type: jsType, | ||
| exports.getCacheKey = getCacheKey; | ||
| function countLinesAndTerminateMap(code, map) { | ||
| function countLines(code) { | ||
| const NEWLINE = /\r\n?|\n|\u2028|\u2029/g; | ||
@@ -544,5 +557,11 @@ let lineCount = 1; | ||
| } | ||
| const lastLineLength = code.length - lastLineStart; | ||
| return { | ||
| lineCount, | ||
| lastLineColumn: code.length - lastLineStart, | ||
| }; | ||
| } | ||
| function countLinesAndTerminateMap(code, map) { | ||
| const { lineCount, lastLineColumn } = countLines(code); | ||
| const lastLineIndex1Based = lineCount; | ||
| const lastLineNextColumn0Based = lastLineLength; | ||
| const lastLineNextColumn0Based = lastLineColumn; | ||
| const lastMapping = map[map.length - 1]; | ||
@@ -565,5 +584,1 @@ const terminatingMapping = [lastLineIndex1Based, lastLineNextColumn0Based]; | ||
| } | ||
| var _default = (exports.default = { | ||
| getCacheKey, | ||
| transform, | ||
| }); |
Sorry, the diff of this file is not supported yet
50776
1.74%781
0.26%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated