webpack
Advanced tools
Comparing version 5.90.1 to 5.90.2
@@ -47,3 +47,3 @@ /* | ||
* @property {Set<Module>=} skippedItems modules that were skipped because module is already available in parent chunks (need to reconsider when minAvailableModules is shrinking) | ||
* @property {Set<[Module, ConnectionState]>=} skippedModuleConnections referenced modules that where skipped because they were not active in this runtime | ||
* @property {Set<[Module, ModuleGraphConnection[]]>=} skippedModuleConnections referenced modules that where skipped because they were not active in this runtime | ||
* @property {ModuleSetPlus | undefined} resultingAvailableModules set of modules available including modules from this chunk group | ||
@@ -77,2 +77,21 @@ * @property {Set<ChunkGroupInfo> | undefined} children set of children chunk groups, that will be revisited when availableModules shrink | ||
/** | ||
* @param {ModuleGraphConnection[]} connections list of connections | ||
* @param {RuntimeSpec} runtime for which runtime | ||
* @returns {ConnectionState} connection state | ||
*/ | ||
const getActiveStateOfConnections = (connections, runtime) => { | ||
let merged = connections[0].getActiveState(runtime); | ||
if (merged === true) return true; | ||
for (let i = 1; i < connections.length; i++) { | ||
const c = connections[i]; | ||
merged = ModuleGraphConnection.addConnectionStates( | ||
merged, | ||
c.getActiveState(runtime) | ||
); | ||
if (merged === true) return true; | ||
} | ||
return merged; | ||
}; | ||
const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => { | ||
@@ -104,5 +123,2 @@ let blockCache; | ||
if (connection.weak) continue; | ||
const state = connection.getActiveState(runtime); | ||
// We skip inactive connections | ||
if (state === false) continue; | ||
@@ -121,5 +137,6 @@ const block = moduleGraph.getParentBlock(d); | ||
const i = index << 2; | ||
const i = index * 3; | ||
modules[i] = m; | ||
modules[i + 1] = state; | ||
modules[i + 1] = connection.getActiveState(runtime); | ||
modules[i + 2] = connection; | ||
} | ||
@@ -131,11 +148,13 @@ | ||
let length = 0; | ||
outer: for (let j = 0; j < modules.length; j += 2) { | ||
outer: for (let j = 0; j < modules.length; j += 3) { | ||
const m = modules[j]; | ||
if (m === undefined) continue; | ||
const state = modules[j + 1]; | ||
const connection = modules[j + 2]; | ||
if (indexMap === undefined) { | ||
let i = 0; | ||
for (; i < length; i += 2) { | ||
for (; i < length; i += 3) { | ||
if (modules[i] === m) { | ||
const merged = modules[i + 1]; | ||
modules[i + 2].push(connection); | ||
if (merged === true) continue outer; | ||
@@ -146,2 +165,3 @@ modules[i + 1] = ModuleGraphConnection.addConnectionStates( | ||
); | ||
continue outer; | ||
} | ||
@@ -153,2 +173,4 @@ } | ||
length++; | ||
modules[length] = [connection]; | ||
length++; | ||
if (length > 30) { | ||
@@ -159,3 +181,3 @@ // To avoid worse case performance, we will use an index map for | ||
indexMap = new Map(); | ||
for (let i = 0; i < length; i += 2) { | ||
for (let i = 0; i < length; i += 3) { | ||
indexMap.set(modules[i], i + 1); | ||
@@ -168,2 +190,3 @@ } | ||
const merged = modules[idx]; | ||
modules[idx + 1].push(connection); | ||
if (merged === true) continue outer; | ||
@@ -180,2 +203,4 @@ modules[idx] = ModuleGraphConnection.addConnectionStates( | ||
length++; | ||
modules[length] = [connection]; | ||
length++; | ||
} | ||
@@ -220,3 +245,3 @@ } | ||
* @param {RuntimeSpec} runtime runtime | ||
* @returns {(Module | ConnectionState)[]} block modules in flatten tuples | ||
* @returns {(Module | ConnectionState | ModuleGraphConnection[])[]} block modules in flatten tuples | ||
*/ | ||
@@ -396,3 +421,3 @@ const getBlockModules = (block, runtime) => { | ||
/** @type {[Module, ConnectionState][]} */ | ||
/** @type {[Module, ModuleGraphConnection[]][]} */ | ||
const skipConnectionBuffer = []; | ||
@@ -597,3 +622,3 @@ /** @type {Module[]} */ | ||
// Traverse all referenced modules | ||
for (let i = 0; i < blockModules.length; i += 2) { | ||
for (let i = 0; i < blockModules.length; i += 3) { | ||
const refModule = /** @type {Module} */ (blockModules[i]); | ||
@@ -608,3 +633,7 @@ if (chunkGraph.isModuleInChunk(refModule, chunk)) { | ||
if (activeState !== true) { | ||
skipConnectionBuffer.push([refModule, activeState]); | ||
const connections = /** @type {ModuleGraphConnection[]} */ ( | ||
blockModules[i + 2] | ||
); | ||
skipConnectionBuffer.push([refModule, connections]); | ||
// We skip inactive connections | ||
if (activeState === false) continue; | ||
@@ -683,3 +712,3 @@ } | ||
// Traverse all referenced modules | ||
for (let i = 0; i < blockModules.length; i += 2) { | ||
for (let i = 0; i < blockModules.length; i += 3) { | ||
const refModule = /** @type {Module} */ (blockModules[i]); | ||
@@ -1190,3 +1219,7 @@ const activeState = /** @type {ConnectionState} */ ( | ||
for (const entry of info.skippedModuleConnections) { | ||
const [module, activeState] = entry; | ||
const [module, connections] = entry; | ||
const activeState = getActiveStateOfConnections( | ||
connections, | ||
info.runtime | ||
); | ||
if (activeState === false) continue; | ||
@@ -1305,3 +1338,3 @@ if (activeState === true) { | ||
for (let i = 0; i < blockModules.length; i += 2) { | ||
for (let i = 0; i < blockModules.length; i += 3) { | ||
const refModule = /** @type {Module} */ (blockModules[i]); | ||
@@ -1308,0 +1341,0 @@ const activeState = /** @type {ConnectionState} */ ( |
@@ -28,3 +28,3 @@ /* | ||
* @param {Module} module the module | ||
* @param {string | null} exportName name of the export if any | ||
* @param {string[] | null} exportName name of the export if any | ||
* @param {string | null} property name of the requested property | ||
@@ -55,5 +55,3 @@ * @param {RuntimeSpec} runtime for which runtime | ||
const exportsInfo = moduleGraph.getExportsInfo(module); | ||
const exportInfo = exportsInfo.getExportInfo( | ||
/** @type {string} */ (exportName) | ||
); | ||
const exportInfo = exportsInfo.getExportInfo(exportName[0]); | ||
if (exportInfo) return exportInfo.canMangle; | ||
@@ -64,5 +62,3 @@ return exportsInfo.otherExportsInfo.canMangle; | ||
return ( | ||
moduleGraph | ||
.getExportsInfo(module) | ||
.getUsed(/** @type {string} */ (exportName), runtime) !== | ||
moduleGraph.getExportsInfo(module).getUsed(exportName, runtime) !== | ||
UsageState.Unused | ||
@@ -73,3 +69,3 @@ ); | ||
.getExportsInfo(module) | ||
.getUsed(/** @type {string} */ (exportName), runtime); | ||
.getUsed(exportName, runtime); | ||
switch (state) { | ||
@@ -90,5 +86,3 @@ case UsageState.Used: | ||
case "provideInfo": | ||
return moduleGraph | ||
.getExportsInfo(module) | ||
.isExportProvided(/** @type {string} */ (exportName)); | ||
return moduleGraph.getExportsInfo(module).isExportProvided(exportName); | ||
} | ||
@@ -101,3 +95,3 @@ return undefined; | ||
* @param {Range} range range | ||
* @param {TODO} exportName export name | ||
* @param {string[] | null} exportName export name | ||
* @param {string | null} property property | ||
@@ -104,0 +98,0 @@ */ |
@@ -195,3 +195,3 @@ /* | ||
name: ids ? ids.concat([key]) : [key], | ||
canMangle: false | ||
canMangle: Array.isArray(ids) && ids.length > 0 | ||
}); | ||
@@ -198,0 +198,0 @@ } |
@@ -290,2 +290,3 @@ /* | ||
dep.loc = /** @type {DependencyLocation} */ (expr.loc); | ||
dep.optional = !!parser.scope.inTry; | ||
depBlock.addDependency(dep); | ||
@@ -292,0 +293,0 @@ parser.state.current.addBlock(depBlock); |
@@ -218,3 +218,3 @@ /* | ||
return Promise.all(results); | ||
return Promise.all(results).then(function () {}); | ||
} | ||
@@ -221,0 +221,0 @@ |
@@ -59,3 +59,3 @@ /* | ||
"var i = scripts.length - 1;", | ||
"while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;" | ||
"while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;" | ||
]), | ||
@@ -62,0 +62,0 @@ "}" |
@@ -50,10 +50,5 @@ /* | ||
for (let i = 0, len = str.length; i < len; i++) { | ||
let code = str.charCodeAt(i); | ||
if (code > 0xff) { | ||
hash ^= code & 0xff; | ||
hash = (hash * FNV_PRIME_32) | 0; | ||
code >>= 8; | ||
} | ||
hash ^= code; | ||
hash = (hash * FNV_PRIME_32) | 0; | ||
hash ^= str.charCodeAt(i); | ||
// Use Math.imul to do c-style 32-bit multiplication and keep only the 32 least significant bits | ||
hash = Math.imul(hash, FNV_PRIME_32); | ||
} | ||
@@ -73,9 +68,3 @@ // Force the result to be positive | ||
for (let i = 0, len = str.length; i < len; i++) { | ||
let code = str.charCodeAt(i); | ||
if (code > 0xff) { | ||
hash ^= BigInt(code & 0xff); | ||
hash = BigInt.asUintN(64, hash * FNV_PRIME_64); | ||
code >>= 8; | ||
} | ||
hash ^= BigInt(code); | ||
hash ^= BigInt(str.charCodeAt(i)); | ||
hash = BigInt.asUintN(64, hash * FNV_PRIME_64); | ||
@@ -82,0 +71,0 @@ } |
{ | ||
"name": "webpack", | ||
"version": "5.90.1", | ||
"version": "5.90.2", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -60,3 +60,3 @@ "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", | ||
"eslint-plugin-jest": "^27.6.3", | ||
"eslint-plugin-jsdoc": "^43.0.5", | ||
"eslint-plugin-jsdoc": "^48.1.0", | ||
"eslint-plugin-n": "^16.6.2", | ||
@@ -63,0 +63,0 @@ "eslint-plugin-prettier": "^5.1.3", |
4817878
137833