Comparing version 0.73.9 to 0.73.10
{ | ||
"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
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
743662
11212
51
+ Addedjsc-safe-url@^0.2.2
+ Addedjsc-safe-url@0.2.4(transitive)
+ Addedmetro-babel-transformer@0.73.10(transitive)
+ Addedmetro-cache@0.73.10(transitive)
+ Addedmetro-cache-key@0.73.10(transitive)
+ Addedmetro-config@0.73.10(transitive)
+ Addedmetro-core@0.73.10(transitive)
+ Addedmetro-file-map@0.73.10(transitive)
+ Addedmetro-hermes-compiler@0.73.10(transitive)
+ Addedmetro-inspector-proxy@0.73.10(transitive)
+ Addedmetro-minify-terser@0.73.10(transitive)
+ Addedmetro-minify-uglify@0.73.10(transitive)
+ Addedmetro-react-native-babel-preset@0.73.10(transitive)
+ Addedmetro-resolver@0.73.10(transitive)
+ Addedmetro-runtime@0.73.10(transitive)
+ Addedmetro-source-map@0.73.10(transitive)
+ Addedmetro-symbolicate@0.73.10(transitive)
+ Addedmetro-transform-plugins@0.73.10(transitive)
+ Addedmetro-transform-worker@0.73.10(transitive)
+ Addedob1@0.73.10(transitive)
- Removedmetro-babel-transformer@0.73.9(transitive)
- Removedmetro-cache@0.73.9(transitive)
- Removedmetro-cache-key@0.73.9(transitive)
- Removedmetro-config@0.73.9(transitive)
- Removedmetro-core@0.73.9(transitive)
- Removedmetro-file-map@0.73.9(transitive)
- Removedmetro-hermes-compiler@0.73.9(transitive)
- Removedmetro-inspector-proxy@0.73.9(transitive)
- Removedmetro-minify-terser@0.73.9(transitive)
- Removedmetro-minify-uglify@0.73.9(transitive)
- Removedmetro-react-native-babel-preset@0.73.9(transitive)
- Removedmetro-resolver@0.73.9(transitive)
- Removedmetro-runtime@0.73.9(transitive)
- Removedmetro-source-map@0.73.9(transitive)
- Removedmetro-symbolicate@0.73.9(transitive)
- Removedmetro-transform-plugins@0.73.9(transitive)
- Removedmetro-transform-worker@0.73.9(transitive)
- Removedob1@0.73.9(transitive)
Updatedmetro-cache@0.73.10
Updatedmetro-cache-key@0.73.10
Updatedmetro-config@0.73.10
Updatedmetro-core@0.73.10
Updatedmetro-file-map@0.73.10
Updatedmetro-minify-terser@0.73.10
Updatedmetro-minify-uglify@0.73.10
Updatedmetro-resolver@0.73.10
Updatedmetro-runtime@0.73.10
Updatedmetro-source-map@0.73.10
Updatedmetro-symbolicate@0.73.10