metro
Advanced tools
Comparing version 0.80.1 to 0.80.2
{ | ||
"name": "metro", | ||
"version": "0.80.1", | ||
"version": "0.80.2", | ||
"description": "🚇 The JavaScript bundler for React Native.", | ||
@@ -31,3 +31,3 @@ "main": "src/index.js", | ||
"graceful-fs": "^4.2.4", | ||
"hermes-parser": "0.17.1", | ||
"hermes-parser": "0.18.0", | ||
"image-size": "^1.0.2", | ||
@@ -38,15 +38,15 @@ "invariant": "^2.2.4", | ||
"lodash.throttle": "^4.1.1", | ||
"metro-babel-transformer": "0.80.1", | ||
"metro-cache": "0.80.1", | ||
"metro-cache-key": "0.80.1", | ||
"metro-config": "0.80.1", | ||
"metro-core": "0.80.1", | ||
"metro-file-map": "0.80.1", | ||
"metro-minify-terser": "0.80.1", | ||
"metro-resolver": "0.80.1", | ||
"metro-runtime": "0.80.1", | ||
"metro-source-map": "0.80.1", | ||
"metro-symbolicate": "0.80.1", | ||
"metro-transform-plugins": "0.80.1", | ||
"metro-transform-worker": "0.80.1", | ||
"metro-babel-transformer": "0.80.2", | ||
"metro-cache": "0.80.2", | ||
"metro-cache-key": "0.80.2", | ||
"metro-config": "0.80.2", | ||
"metro-core": "0.80.2", | ||
"metro-file-map": "0.80.2", | ||
"metro-minify-terser": "0.80.2", | ||
"metro-resolver": "0.80.2", | ||
"metro-runtime": "0.80.2", | ||
"metro-source-map": "0.80.2", | ||
"metro-symbolicate": "0.80.2", | ||
"metro-transform-plugins": "0.80.2", | ||
"metro-transform-worker": "0.80.2", | ||
"mime-types": "^2.1.27", | ||
@@ -72,4 +72,4 @@ "node-fetch": "^2.2.0", | ||
"jest-snapshot-serializer-raw": "^1.2.0", | ||
"metro-babel-register": "0.80.1", | ||
"metro-memory-fs": "0.80.1", | ||
"metro-babel-register": "0.80.2", | ||
"metro-memory-fs": "0.80.2", | ||
"mock-req": "^0.2.0", | ||
@@ -76,0 +76,0 @@ "mock-res": "^0.6.0", |
@@ -14,4 +14,4 @@ /** | ||
var _Graph = require("./Graph"); | ||
var _path = _interopRequireDefault(require("path")); | ||
var _Graph = require("./Graph"); | ||
function _interopRequireDefault(obj) { | ||
@@ -18,0 +18,0 @@ return obj && obj.__esModule ? obj : { default: obj }; |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.Graph = void 0; | ||
var _contextModule = require("../lib/contextModule"); | ||
var _CountingSet = _interopRequireDefault(require("../lib/CountingSet")); | ||
var _contextModule = require("../lib/contextModule"); | ||
var path = _interopRequireWildcard(require("path")); | ||
@@ -165,3 +165,3 @@ function _getRequireWildcardCache(nodeInterop) { | ||
} | ||
this._collectCycles(delta); | ||
this._collectCycles(delta, internalOptions); | ||
const added = new Map(); | ||
@@ -589,2 +589,14 @@ for (const path of delta.added) { | ||
// Iterate "children" of the given module - i.e. non-weak / async | ||
// dependencies having a corresponding inverse dependency. | ||
*_children(module, options) { | ||
for (const dependency of module.dependencies.values()) { | ||
const asyncType = dependency.data.data.asyncType; | ||
if (asyncType === "weak" || (options.lazy && asyncType != null)) { | ||
continue; | ||
} | ||
yield nullthrows(this.dependencies.get(dependency.absolutePath)); | ||
} | ||
} | ||
// Delete an unreachable module (and its outbound edges) from the graph | ||
@@ -630,3 +642,3 @@ // immediately. | ||
// Collect any unreachable cycles in the graph. | ||
_collectCycles(delta) { | ||
_collectCycles(delta, options) { | ||
// Mark recursively from roots (trial deletion) | ||
@@ -637,3 +649,3 @@ for (const path of this.#gc.possibleCycleRoots) { | ||
if (color === "purple") { | ||
this._markGray(module); | ||
this._markGray(module, options); | ||
} else { | ||
@@ -653,3 +665,3 @@ this.#gc.possibleCycleRoots.delete(path); | ||
const module = nullthrows(this.dependencies.get(path)); | ||
this._scan(module); | ||
this._scan(module, options); | ||
} | ||
@@ -663,17 +675,14 @@ // Collect recursively from roots (free unreachable cycles) | ||
} | ||
_markGray(module) { | ||
_markGray(module, options) { | ||
const color = nullthrows(this.#gc.color.get(module.path)); | ||
if (color !== "gray") { | ||
this.#gc.color.set(module.path, "gray"); | ||
for (const dependency of module.dependencies.values()) { | ||
const childModule = nullthrows( | ||
this.dependencies.get(dependency.absolutePath) | ||
); | ||
for (const childModule of this._children(module, options)) { | ||
// The inverse dependency will be restored during the scan phase if this module remains live. | ||
childModule.inverseDependencies.delete(module.path); | ||
this._markGray(childModule); | ||
this._markGray(childModule, options); | ||
} | ||
} | ||
} | ||
_scan(module) { | ||
_scan(module, options) { | ||
const color = nullthrows(this.#gc.color.get(module.path)); | ||
@@ -685,10 +694,7 @@ if (color === "gray") { | ||
) { | ||
this._scanBlack(module); | ||
this._scanBlack(module, options); | ||
} else { | ||
this.#gc.color.set(module.path, "white"); | ||
for (const dependency of module.dependencies.values()) { | ||
const childModule = nullthrows( | ||
this.dependencies.get(dependency.absolutePath) | ||
); | ||
this._scan(childModule); | ||
for (const childModule of this._children(module, options)) { | ||
this._scan(childModule, options); | ||
} | ||
@@ -698,8 +704,5 @@ } | ||
} | ||
_scanBlack(module) { | ||
_scanBlack(module, options) { | ||
this.#gc.color.set(module.path, "black"); | ||
for (const dependency of module.dependencies.values()) { | ||
const childModule = nullthrows( | ||
this.dependencies.get(dependency.absolutePath) | ||
); | ||
for (const childModule of this._children(module, options)) { | ||
// The inverse dependency must have been deleted during the mark phase. | ||
@@ -709,3 +712,3 @@ childModule.inverseDependencies.add(module.path); | ||
if (childColor !== "black") { | ||
this._scanBlack(childModule); | ||
this._scanBlack(childModule, options); | ||
} | ||
@@ -712,0 +715,0 @@ } |
@@ -26,3 +26,3 @@ /** | ||
options.clientUrl.pathname = path.relative( | ||
options.projectRoot, | ||
options.serverRoot ?? options.projectRoot, | ||
path.join( | ||
@@ -63,2 +63,3 @@ path.dirname(module.path), | ||
// $FlowFixMe[prop-missing] | ||
// $FlowFixMe[invalid-computed-prop] | ||
inverseDependenciesById[options.createModuleId(path)] = inverseDependencies[ | ||
@@ -65,0 +66,0 @@ path |
@@ -9,4 +9,4 @@ "use strict"; | ||
var _crypto = _interopRequireDefault(require("crypto")); | ||
var _nullthrows = _interopRequireDefault(require("nullthrows")); | ||
var _path = _interopRequireDefault(require("path")); | ||
var _nullthrows = _interopRequireDefault(require("nullthrows")); | ||
function _interopRequireDefault(obj) { | ||
@@ -13,0 +13,0 @@ return obj && obj.__esModule ? obj : { default: obj }; |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.getContextModuleTemplate = getContextModuleTemplate; | ||
var os = _interopRequireWildcard(require("os")); | ||
var path = _interopRequireWildcard(require("path")); | ||
var os = _interopRequireWildcard(require("os")); | ||
function _getRequireWildcardCache(nodeInterop) { | ||
@@ -11,0 +11,0 @@ if (typeof WeakMap !== "function") return null; |
@@ -13,3 +13,2 @@ /** | ||
const crypto = require("crypto"); | ||
const generate = require("@babel/generator").default; | ||
@@ -19,2 +18,3 @@ const template = require("@babel/template").default; | ||
const types = require("@babel/types"); | ||
const crypto = require("crypto"); | ||
const nullthrows = require("nullthrows"); | ||
@@ -21,0 +21,0 @@ const { isImport } = types; |
@@ -15,3 +15,2 @@ "use strict"; | ||
const canonicalize = require("metro-core/src/canonicalize"); | ||
const createFileMap = require("./DependencyGraph/createFileMap"); | ||
@@ -27,2 +26,3 @@ const { ModuleResolver } = require("./DependencyGraph/ModuleResolution"); | ||
} = require("metro-core"); | ||
const canonicalize = require("metro-core/src/canonicalize"); | ||
const { InvalidPackageError } = require("metro-resolver"); | ||
@@ -29,0 +29,0 @@ const nullthrows = require("nullthrows"); |
@@ -31,7 +31,9 @@ /** | ||
const transformHelpers = require("./lib/transformHelpers"); | ||
const { | ||
UnableToResolveError, | ||
} = require("./node-haste/DependencyGraph/ModuleResolution"); | ||
const parsePlatformFilePath = require("./node-haste/lib/parsePlatformFilePath"); | ||
const MultipartResponse = require("./Server/MultipartResponse"); | ||
const symbolicate = require("./Server/symbolicate"); | ||
const { codeFrameColumns } = require("@babel/code-frame"); | ||
const MultipartResponse = require("./Server/MultipartResponse"); | ||
const { performance } = require("perf_hooks"); | ||
const debug = require("debug")("Metro:Server"); | ||
@@ -48,2 +50,3 @@ const fs = require("graceful-fs"); | ||
const path = require("path"); | ||
const { performance } = require("perf_hooks"); | ||
const querystring = require("querystring"); | ||
@@ -453,7 +456,18 @@ const url = require("url"); | ||
*/ | ||
const resolvedEntryFilePath = await this._resolveRelativePath(entryFile, { | ||
relativeTo: "server", | ||
resolverOptions, | ||
transformOptions, | ||
}); | ||
let resolvedEntryFilePath; | ||
try { | ||
resolvedEntryFilePath = await this._resolveRelativePath(entryFile, { | ||
relativeTo: "server", | ||
resolverOptions, | ||
transformOptions, | ||
}); | ||
} catch (error) { | ||
const formattedError = formatBundlingError(error); | ||
const status = error instanceof UnableToResolveError ? 404 : 500; | ||
res.writeHead(status, { | ||
"Content-Type": "application/json; charset=UTF-8", | ||
}); | ||
res.end(JSON.stringify(formattedError)); | ||
return; | ||
} | ||
const graphId = getGraphId(resolvedEntryFilePath, transformOptions, { | ||
@@ -460,0 +474,0 @@ unstable_allowRequireContext: |
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
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
791730
12418
+ Added@types/node@20.12.12(transitive)
+ Addedcaniuse-lite@1.0.30001618(transitive)
+ Addedhermes-estree@0.18.0(transitive)
+ Addedhermes-parser@0.18.0(transitive)
+ Addedmetro-babel-transformer@0.80.2(transitive)
+ Addedmetro-cache@0.80.2(transitive)
+ Addedmetro-cache-key@0.80.2(transitive)
+ Addedmetro-config@0.80.2(transitive)
+ Addedmetro-core@0.80.2(transitive)
+ Addedmetro-file-map@0.80.2(transitive)
+ Addedmetro-minify-terser@0.80.2(transitive)
+ Addedmetro-resolver@0.80.2(transitive)
+ Addedmetro-runtime@0.80.2(transitive)
+ Addedmetro-source-map@0.80.2(transitive)
+ Addedmetro-symbolicate@0.80.2(transitive)
+ Addedmetro-transform-plugins@0.80.2(transitive)
+ Addedmetro-transform-worker@0.80.2(transitive)
+ Addedob1@0.80.2(transitive)
+ Addedundici-types@5.26.5(transitive)
+ Addedupdate-browserslist-db@1.0.16(transitive)
- Removedelectron-to-chromium@1.4.763(transitive)
- Removedhermes-estree@0.17.1(transitive)
- Removedhermes-parser@0.17.1(transitive)
- Removedmetro-babel-transformer@0.80.1(transitive)
- Removedmetro-cache@0.80.1(transitive)
- Removedmetro-cache-key@0.80.1(transitive)
- Removedmetro-config@0.80.1(transitive)
- Removedmetro-core@0.80.1(transitive)
- Removedmetro-file-map@0.80.1(transitive)
- Removedmetro-minify-terser@0.80.1(transitive)
- Removedmetro-resolver@0.80.1(transitive)
- Removedmetro-runtime@0.80.1(transitive)
- Removedmetro-source-map@0.80.1(transitive)
- Removedmetro-symbolicate@0.80.1(transitive)
- Removedmetro-transform-plugins@0.80.1(transitive)
- Removedmetro-transform-worker@0.80.1(transitive)
- Removedob1@0.80.1(transitive)
Updatedhermes-parser@0.18.0
Updatedmetro-cache@0.80.2
Updatedmetro-cache-key@0.80.2
Updatedmetro-config@0.80.2
Updatedmetro-core@0.80.2
Updatedmetro-file-map@0.80.2
Updatedmetro-minify-terser@0.80.2
Updatedmetro-resolver@0.80.2
Updatedmetro-runtime@0.80.2
Updatedmetro-source-map@0.80.2
Updatedmetro-symbolicate@0.80.2