Socket
Socket
Sign inDemoInstall

metro

Package Overview
Dependencies
Maintainers
2
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro - npm Package Compare versions

Comparing version 0.73.9 to 0.73.10

45

package.json
{
"name": "metro",
"version": "0.73.9",
"version": "0.73.10",
"description": "🚇 The JavaScript bundler for React Native.",

@@ -37,20 +37,21 @@ "main": "src/index.js",

"jest-worker": "^27.2.0",
"jsc-safe-url": "^0.2.2",
"lodash.throttle": "^4.1.1",
"metro-babel-transformer": "0.73.9",
"metro-cache": "0.73.9",
"metro-cache-key": "0.73.9",
"metro-config": "0.73.9",
"metro-core": "0.73.9",
"metro-file-map": "0.73.9",
"metro-hermes-compiler": "0.73.9",
"metro-inspector-proxy": "0.73.9",
"metro-minify-terser": "0.73.9",
"metro-minify-uglify": "0.73.9",
"metro-react-native-babel-preset": "0.73.9",
"metro-resolver": "0.73.9",
"metro-runtime": "0.73.9",
"metro-source-map": "0.73.9",
"metro-symbolicate": "0.73.9",
"metro-transform-plugins": "0.73.9",
"metro-transform-worker": "0.73.9",
"metro-babel-transformer": "0.73.10",
"metro-cache": "0.73.10",
"metro-cache-key": "0.73.10",
"metro-config": "0.73.10",
"metro-core": "0.73.10",
"metro-file-map": "0.73.10",
"metro-hermes-compiler": "0.73.10",
"metro-inspector-proxy": "0.73.10",
"metro-minify-terser": "0.73.10",
"metro-minify-uglify": "0.73.10",
"metro-react-native-babel-preset": "0.73.10",
"metro-resolver": "0.73.10",
"metro-runtime": "0.73.10",
"metro-source-map": "0.73.10",
"metro-symbolicate": "0.73.10",
"metro-transform-plugins": "0.73.10",
"metro-transform-worker": "0.73.10",
"mime-types": "^2.1.27",

@@ -74,6 +75,6 @@ "node-fetch": "^2.2.0",

"jest-snapshot-serializer-raw": "^1.2.0",
"metro-babel-register": "0.73.9",
"metro-memory-fs": "0.73.9",
"metro-react-native-babel-preset": "0.73.9",
"metro-react-native-babel-transformer": "0.73.9",
"metro-babel-register": "0.73.10",
"metro-memory-fs": "0.73.10",
"metro-react-native-babel-preset": "0.73.10",
"metro-react-native-babel-transformer": "0.73.10",
"mock-req": "^0.2.0",

@@ -80,0 +81,0 @@ "mock-res": "^0.6.0",

@@ -15,2 +15,3 @@ /**

const { isJsModule, wrapModule } = require("./helpers/js");
const jscSafeUrl = require("jsc-safe-url");
const { addParamsToDefineCall } = require("metro-transform-plugins");

@@ -37,3 +38,3 @@ const path = require("path");

const sourceMappingURL = getURL("map");
const sourceURL = getURL("bundle");
const sourceURL = jscSafeUrl.toJscSafeUrl(getURL("bundle"));
const code =

@@ -40,0 +41,0 @@ prepareModule(module, graph, options) +

@@ -17,2 +17,3 @@ /**

const parseCustomTransformOptions = require("./parseCustomTransformOptions");
const jscSafeUrl = require("jsc-safe-url");
const nullthrows = require("nullthrows");

@@ -36,7 +37,7 @@ const path = require("path");

module.exports = function parseOptionsFromUrl(
requestUrl,
normalizedRequestUrl,
platforms,
bytecodeVersion
) {
const parsedURL = nullthrows(url.parse(requestUrl, true)); // `true` to parse the query param as an object.
const parsedURL = nullthrows(url.parse(normalizedRequestUrl, true)); // `true` to parse the query param as an object.
const query = nullthrows(parsedURL.query);

@@ -81,3 +82,3 @@ const pathname =

}),
sourceUrl: requestUrl,
sourceUrl: jscSafeUrl.toJscSafeUrl(normalizedRequestUrl),
unstable_transformProfile: getTransformProfile(

@@ -84,0 +85,0 @@ query.unstable_transformProfile

@@ -39,2 +39,4 @@ /**

const fs = require("graceful-fs");
const invariant = require("invariant");
const jscSafeUrl = require("jsc-safe-url");
const {

@@ -366,5 +368,10 @@ Logger,

}
_rewriteAndNormalizeUrl(requestUrl) {
return jscSafeUrl.toNormalUrl(
this._config.server.rewriteRequestUrl(jscSafeUrl.toNormalUrl(requestUrl))
);
}
async _processRequest(req, res, next) {
const originalUrl = req.url;
req.url = this._config.server.rewriteRequestUrl(req.url);
req.url = this._rewriteAndNormalizeUrl(req.url);
const urlObj = url.parse(req.url, true);

@@ -740,3 +747,3 @@ const { host } = req.headers;

},
finish({ req, mres, result }) {
finish({ req, mres, serializerOptions, result }) {
if (

@@ -758,2 +765,9 @@ // We avoid parsing the dates since the client should never send a more

mres.setHeader(DELTA_ID_HEADER, String(result.nextRevId));
if (
(serializerOptions === null || serializerOptions === void 0
? void 0
: serializerOptions.sourceUrl) != null
) {
mres.setHeader("Content-Location", serializerOptions.sourceUrl);
}
mres.setHeader("Content-Type", "application/javascript; charset=UTF-8");

@@ -1040,14 +1054,24 @@ mres.setHeader("Last-Modified", result.lastModifiedDate.toUTCString());

const body = await req.rawBody;
const stack = JSON.parse(body).stack.map((frame) => {
if (frame.file && frame.file.includes("://")) {
const parsedBody = JSON.parse(body);
const rewriteAndNormalizeStackFrame = (frame, lineNumber) => {
invariant(
frame != null && typeof frame === "object",
"Bad stack frame at line %d, expected object, received: %s",
lineNumber,
typeof frame
);
const frameFile = frame.file;
if (typeof frameFile === "string" && frameFile.includes("://")) {
return {
...frame,
file: this._config.server.rewriteRequestUrl(frame.file),
file: this._rewriteAndNormalizeUrl(frameFile),
};
}
return frame;
});
};
const stack = parsedBody.stack.map(rewriteAndNormalizeStackFrame);
// In case of multiple bundles / HMR, some stack frames can have different URLs from others
const urls = new Set();
stack.forEach((frame) => {
// These urls have been rewritten and normalized above.
const sourceUrl = frame.file;

@@ -1066,4 +1090,7 @@ // Skip `/debuggerWorker.js` which does not need symbolication.

const sourceMaps = await Promise.all(
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
Array.from(urls.values()).map(this._explodedSourceMapForURL, this)
Array.from(urls.values()).map((normalizedUrl) =>
this._explodedSourceMapForBundleOptions(
this._parseOptions(normalizedUrl)
)
)
);

@@ -1096,8 +1123,3 @@ debug("Performing fast symbolication");

}
async _explodedSourceMapForURL(reqUrl) {
const options = parseOptionsFromUrl(
reqUrl,
new Set(this._config.resolver.platforms),
getBytecodeVersion()
);
async _explodedSourceMapForBundleOptions(bundleOptions) {
const {

@@ -1110,3 +1132,3 @@ entryFile,

transformOptions,
} = splitBundleOptions(options);
} = splitBundleOptions(bundleOptions);

@@ -1113,0 +1135,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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