Socket
Socket
Sign inDemoInstall

metro-transform-worker

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-transform-worker - npm Package Compare versions

Comparing version 0.80.7 to 0.80.8

18

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc