metro-transform-worker
Advanced tools
Comparing version 0.80.7 to 0.80.8
{ | ||
"name": "metro-transform-worker", | ||
"version": "0.80.7", | ||
"version": "0.80.8", | ||
"description": "🚇 Transform worker for Metro.", | ||
@@ -20,13 +20,13 @@ "main": "src/index.js", | ||
"@babel/types": "^7.20.0", | ||
"metro": "0.80.7", | ||
"metro-babel-transformer": "0.80.7", | ||
"metro-cache": "0.80.7", | ||
"metro-cache-key": "0.80.7", | ||
"metro-minify-terser": "0.80.7", | ||
"metro-source-map": "0.80.7", | ||
"metro-transform-plugins": "0.80.7", | ||
"metro": "0.80.8", | ||
"metro-babel-transformer": "0.80.8", | ||
"metro-cache": "0.80.8", | ||
"metro-cache-key": "0.80.8", | ||
"metro-minify-terser": "0.80.8", | ||
"metro-source-map": "0.80.8", | ||
"metro-transform-plugins": "0.80.8", | ||
"nullthrows": "^1.1.1" | ||
}, | ||
"devDependencies": { | ||
"metro-memory-fs": "0.80.7", | ||
"metro-memory-fs": "0.80.8", | ||
"@react-native/metro-babel-transformer": "0.73.11" | ||
@@ -33,0 +33,0 @@ }, |
@@ -17,3 +17,2 @@ "use strict"; | ||
const metroTransformPlugins = require("metro-transform-plugins"); | ||
const countLines = require("metro/src/lib/countLines"); | ||
const collectDependencies = require("metro/src/ModuleGraph/worker/collectDependencies"); | ||
@@ -251,2 +250,4 @@ const { | ||
} | ||
let lineCount; | ||
({ lineCount, map } = countLinesAndTerminateMap(code, map)); | ||
const output = [ | ||
@@ -256,3 +257,3 @@ { | ||
code, | ||
lineCount: countLines(code), | ||
lineCount, | ||
map, | ||
@@ -329,2 +330,4 @@ functionMap: file.functionMap, | ||
} | ||
let lineCount; | ||
({ lineCount, map } = countLinesAndTerminateMap(code, map)); | ||
const output = [ | ||
@@ -334,3 +337,3 @@ { | ||
code, | ||
lineCount: countLines(code), | ||
lineCount, | ||
map, | ||
@@ -418,2 +421,3 @@ functionMap: null, | ||
const filesKey = getCacheKey([ | ||
__filename, | ||
require.resolve(babelTransformerPath), | ||
@@ -435,1 +439,29 @@ require.resolve(minifierPath), | ||
}; | ||
function countLinesAndTerminateMap(code, map) { | ||
const NEWLINE = /\r\n?|\n|\u2028|\u2029/g; | ||
let lineCount = 1; | ||
let lastLineStart = 0; | ||
for (const match of code.matchAll(NEWLINE)) { | ||
lineCount++; | ||
lastLineStart = match.index + match[0].length; | ||
} | ||
const lastLineLength = code.length - lastLineStart; | ||
const lastLineIndex1Based = lineCount; | ||
const lastLineNextColumn0Based = lastLineLength; | ||
const lastMapping = map[map.length - 1]; | ||
const terminatingMapping = [lastLineIndex1Based, lastLineNextColumn0Based]; | ||
if ( | ||
!lastMapping || | ||
lastMapping[0] !== terminatingMapping[0] || | ||
lastMapping[1] !== terminatingMapping[1] | ||
) { | ||
return { | ||
lineCount, | ||
map: map.concat([terminatingMapping]), | ||
}; | ||
} | ||
return { | ||
lineCount, | ||
map: [...map], | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40056
607
+ Addedmetro@0.80.8(transitive)
+ Addedmetro-babel-transformer@0.80.8(transitive)
+ Addedmetro-cache@0.80.8(transitive)
+ Addedmetro-cache-key@0.80.8(transitive)
+ Addedmetro-config@0.80.8(transitive)
+ Addedmetro-core@0.80.8(transitive)
+ Addedmetro-file-map@0.80.8(transitive)
+ Addedmetro-minify-terser@0.80.8(transitive)
+ Addedmetro-resolver@0.80.8(transitive)
+ Addedmetro-runtime@0.80.8(transitive)
+ Addedmetro-source-map@0.80.8(transitive)
+ Addedmetro-symbolicate@0.80.8(transitive)
+ Addedmetro-transform-plugins@0.80.8(transitive)
+ Addedob1@0.80.8(transitive)
- Removedmetro@0.80.7(transitive)
- Removedmetro-babel-transformer@0.80.7(transitive)
- Removedmetro-cache@0.80.7(transitive)
- Removedmetro-cache-key@0.80.7(transitive)
- Removedmetro-config@0.80.7(transitive)
- Removedmetro-core@0.80.7(transitive)
- Removedmetro-file-map@0.80.7(transitive)
- Removedmetro-minify-terser@0.80.7(transitive)
- Removedmetro-resolver@0.80.7(transitive)
- Removedmetro-runtime@0.80.7(transitive)
- Removedmetro-source-map@0.80.7(transitive)
- Removedmetro-symbolicate@0.80.7(transitive)
- Removedmetro-transform-plugins@0.80.7(transitive)
- Removedob1@0.80.7(transitive)
Updatedmetro@0.80.8
Updatedmetro-cache@0.80.8
Updatedmetro-cache-key@0.80.8
Updatedmetro-minify-terser@0.80.8
Updatedmetro-source-map@0.80.8