From 96aca0e4d7ab239d0b61ffb0b3ea372d1aa11456 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 7 Sep 2021 21:06:46 +0200 Subject: [PATCH 01/34] avoid allocations in SnapshotOptimization --- lib/FileSystemInfo.js | 240 ++++++++++++++---------------------------- 1 file changed, 80 insertions(+), 160 deletions(-) diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index c6f8b060248..836c4b2fad3 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -453,12 +453,14 @@ class SnapshotOptimization { * @param {function(Snapshot): boolean} has has value * @param {function(Snapshot): Map | Set} get get value * @param {function(Snapshot, Map | Set): void} set set value + * @param {boolean=} useStartTime use the start time of snapshots * @param {boolean=} isSet value is an Set instead of a Map */ - constructor(has, get, set, isSet = false) { + constructor(has, get, set, useStartTime = true, isSet = false) { this._has = has; this._get = get; this._set = set; + this._useStartTime = useStartTime; this._isSet = isSet; /** @type {Map} */ this._map = new Map(); @@ -488,24 +490,12 @@ class SnapshotOptimization { this._statReusedSharedSnapshots = 0; } - storeUnsharedSnapshot(snapshot, locations) { - if (locations === undefined) return; - const optimizationEntry = { - snapshot, - shared: 0, - snapshotContent: undefined, - children: undefined - }; - for (const path of locations) { - this._map.set(path, optimizationEntry); - } - } - - optimize(capturedFiles, startTime, children) { - /** @type {Set} */ - const unsetOptimizationEntries = new Set(); - /** @type {Set} */ - const checkedOptimizationEntries = new Set(); + /** + * @param {Snapshot} newSnapshot snapshot + * @param {Set} capturedFiles files to snapshot/share + * @returns {void} + */ + optimize(newSnapshot, capturedFiles) { /** * @param {SnapshotOptimizationEntry} entry optimization entry * @returns {void} @@ -530,22 +520,43 @@ class SnapshotOptimization { capturedFiles.delete(path); } }; + + /** @type {SnapshotOptimizationEntry} */ + let newOptimizationEntry = undefined; + const capturedFilesSize = capturedFiles.size; - capturedFiles: for (const path of capturedFiles) { + + /** @type {Set | undefined} */ + const optimizationEntries = new Set(); + + for (const path of capturedFiles) { const optimizationEntry = this._map.get(path); if (optimizationEntry === undefined) { - unsetOptimizationEntries.add(path); + if (newOptimizationEntry === undefined) { + newOptimizationEntry = { + snapshot: newSnapshot, + shared: 0, + snapshotContent: undefined, + children: undefined + }; + } + this._map.set(path, newOptimizationEntry); continue; + } else { + optimizationEntries.add(optimizationEntry); } - if (checkedOptimizationEntries.has(optimizationEntry)) continue; + } + + optimizationEntries: for (const optimizationEntry of optimizationEntries) { const snapshot = optimizationEntry.snapshot; if (optimizationEntry.shared > 0) { // It's a shared snapshot // We can't change it, so we can only use it when all files match // and startTime is compatible if ( - startTime && - (!snapshot.startTime || snapshot.startTime > startTime) + this._useStartTime && + newSnapshot.startTime && + (!snapshot.startTime || snapshot.startTime > newSnapshot.startTime) ) { continue; } @@ -557,8 +568,7 @@ class SnapshotOptimization { if (!snapshotEntries.has(path)) { // File is not shared and can't be removed from the snapshot // because it's in a child of the snapshot - checkedOptimizationEntries.add(optimizationEntry); - continue capturedFiles; + continue optimizationEntries; } nonSharedFiles.add(path); continue; @@ -567,7 +577,7 @@ class SnapshotOptimization { if (nonSharedFiles.size === 0) { // The complete snapshot is shared // add it as child - children.add(snapshot); + newSnapshot.addChild(snapshot); increaseSharedAndStoreOptimizationEntry(optimizationEntry); this._statReusedSharedSnapshots++; } else { @@ -575,8 +585,7 @@ class SnapshotOptimization { const sharedCount = snapshotContent.size - nonSharedFiles.size; if (sharedCount < MIN_COMMON_SNAPSHOT_SIZE) { // Common part it too small - checkedOptimizationEntries.add(optimizationEntry); - continue capturedFiles; + continue optimizationEntries; } // Extract common timestamps from both snapshots let commonMap; @@ -598,9 +607,11 @@ class SnapshotOptimization { } // Create and attach snapshot const commonSnapshot = new Snapshot(); - commonSnapshot.setMergedStartTime(startTime, snapshot); + if (this._useStartTime) { + commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); + } this._set(commonSnapshot, commonMap); - children.add(commonSnapshot); + newSnapshot.addChild(commonSnapshot); snapshot.addChild(commonSnapshot); // Create optimization entry const newEntry = { @@ -620,6 +631,10 @@ class SnapshotOptimization { // We can extract a common shared snapshot // with all common files const snapshotEntries = this._get(snapshot); + if (snapshotEntries === undefined) { + // Incomplete snapshot, that can't be used + continue optimizationEntries; + } let commonMap; if (this._isSet) { commonMap = new Set(); @@ -645,14 +660,15 @@ class SnapshotOptimization { if (commonMap.size < MIN_COMMON_SNAPSHOT_SIZE) { // Common part it too small - checkedOptimizationEntries.add(optimizationEntry); - continue capturedFiles; + continue optimizationEntries; } // Create and attach snapshot const commonSnapshot = new Snapshot(); - commonSnapshot.setMergedStartTime(startTime, snapshot); + if (this._useStartTime) { + commonSnapshot.setMergedStartTime(newSnapshot.startTime, snapshot); + } this._set(commonSnapshot, commonMap); - children.add(commonSnapshot); + newSnapshot.addChild(commonSnapshot); snapshot.addChild(commonSnapshot); // Remove files from snapshot for (const path of commonMap.keys()) snapshotEntries.delete(path); @@ -668,12 +684,10 @@ class SnapshotOptimization { }); this._statSharedSnapshots++; } - checkedOptimizationEntries.add(optimizationEntry); } const unshared = capturedFiles.size; this._statItemsUnshared += unshared; this._statItemsShared += capturedFilesSize - unshared; - return unsetOptimizationEntries; } } @@ -858,7 +872,8 @@ class FileSystemInfo { this._fileHashesOptimization = new SnapshotOptimization( s => s.hasFileHashes(), s => s.fileHashes, - (s, v) => s.setFileHashes(v) + (s, v) => s.setFileHashes(v), + false ); this._fileTshsOptimization = new SnapshotOptimization( s => s.hasFileTshs(), @@ -873,7 +888,8 @@ class FileSystemInfo { this._contextHashesOptimization = new SnapshotOptimization( s => s.hasContextHashes(), s => s.contextHashes, - (s, v) => s.setContextHashes(v) + (s, v) => s.setContextHashes(v), + false ); this._contextTshsOptimization = new SnapshotOptimization( s => s.hasContextTshs(), @@ -883,29 +899,34 @@ class FileSystemInfo { this._missingExistenceOptimization = new SnapshotOptimization( s => s.hasMissingExistence(), s => s.missingExistence, - (s, v) => s.setMissingExistence(v) + (s, v) => s.setMissingExistence(v), + false ); this._managedItemInfoOptimization = new SnapshotOptimization( s => s.hasManagedItemInfo(), s => s.managedItemInfo, - (s, v) => s.setManagedItemInfo(v) + (s, v) => s.setManagedItemInfo(v), + false ); this._managedFilesOptimization = new SnapshotOptimization( s => s.hasManagedFiles(), s => s.managedFiles, (s, v) => s.setManagedFiles(v), + false, true ); this._managedContextsOptimization = new SnapshotOptimization( s => s.hasManagedContexts(), s => s.managedContexts, (s, v) => s.setManagedContexts(v), + false, true ); this._managedMissingOptimization = new SnapshotOptimization( s => s.hasManagedMissing(), s => s.managedMissing, (s, v) => s.setManagedMissing(v), + false, true ); /** @type {StackedCacheMap} */ @@ -1869,22 +1890,8 @@ class FileSystemInfo { /** @type {Set} */ const children = new Set(); - /** @type {Set} */ - let unsharedFileTimestamps; - /** @type {Set} */ - let unsharedFileHashes; - /** @type {Set} */ - let unsharedFileTshs; - /** @type {Set} */ - let unsharedContextTimestamps; - /** @type {Set} */ - let unsharedContextHashes; - /** @type {Set} */ - let unsharedContextTshs; - /** @type {Set} */ - let unsharedMissingExistence; - /** @type {Set} */ - let unsharedManagedItemInfo; + const snapshot = new Snapshot(); + if (startTime) snapshot.setStartTime(startTime); /** @type {Set} */ const managedItems = new Set(); @@ -1895,101 +1902,41 @@ class FileSystemInfo { let jobs = 1; const jobDone = () => { if (--jobs === 0) { - const snapshot = new Snapshot(); - if (startTime) snapshot.setStartTime(startTime); if (fileTimestamps.size !== 0) { snapshot.setFileTimestamps(fileTimestamps); - this._fileTimestampsOptimization.storeUnsharedSnapshot( - snapshot, - unsharedFileTimestamps - ); } if (fileHashes.size !== 0) { snapshot.setFileHashes(fileHashes); - this._fileHashesOptimization.storeUnsharedSnapshot( - snapshot, - unsharedFileHashes - ); } if (fileTshs.size !== 0) { snapshot.setFileTshs(fileTshs); - this._fileTshsOptimization.storeUnsharedSnapshot( - snapshot, - unsharedFileTshs - ); } if (contextTimestamps.size !== 0) { snapshot.setContextTimestamps(contextTimestamps); - this._contextTimestampsOptimization.storeUnsharedSnapshot( - snapshot, - unsharedContextTimestamps - ); } if (contextHashes.size !== 0) { snapshot.setContextHashes(contextHashes); - this._contextHashesOptimization.storeUnsharedSnapshot( - snapshot, - unsharedContextHashes - ); } if (contextTshs.size !== 0) { snapshot.setContextTshs(contextTshs); - this._contextTshsOptimization.storeUnsharedSnapshot( - snapshot, - unsharedContextTshs - ); } if (missingExistence.size !== 0) { snapshot.setMissingExistence(missingExistence); - this._missingExistenceOptimization.storeUnsharedSnapshot( - snapshot, - unsharedMissingExistence - ); } if (managedItemInfo.size !== 0) { snapshot.setManagedItemInfo(managedItemInfo); - this._managedItemInfoOptimization.storeUnsharedSnapshot( - snapshot, - unsharedManagedItemInfo - ); } - const unsharedManagedFiles = this._managedFilesOptimization.optimize( - managedFiles, - undefined, - children - ); + this._managedFilesOptimization.optimize(snapshot, managedFiles); if (managedFiles.size !== 0) { snapshot.setManagedFiles(managedFiles); - this._managedFilesOptimization.storeUnsharedSnapshot( - snapshot, - unsharedManagedFiles - ); } - const unsharedManagedContexts = - this._managedContextsOptimization.optimize( - managedContexts, - undefined, - children - ); + this._managedContextsOptimization.optimize(snapshot, managedContexts); if (managedContexts.size !== 0) { snapshot.setManagedContexts(managedContexts); - this._managedContextsOptimization.storeUnsharedSnapshot( - snapshot, - unsharedManagedContexts - ); } - const unsharedManagedMissing = - this._managedMissingOptimization.optimize( - managedMissing, - undefined, - children - ); + this._managedMissingOptimization.optimize(snapshot, managedMissing); if (managedMissing.size !== 0) { snapshot.setManagedMissing(managedMissing); - this._managedMissingOptimization.storeUnsharedSnapshot( - snapshot, - unsharedManagedMissing - ); } if (children.size !== 0) { snapshot.setChildren(children); @@ -2037,11 +1984,7 @@ class FileSystemInfo { const capturedFiles = captureNonManaged(files, managedFiles); switch (mode) { case 3: - unsharedFileTshs = this._fileTshsOptimization.optimize( - capturedFiles, - undefined, - children - ); + this._fileTshsOptimization.optimize(snapshot, capturedFiles); for (const path of capturedFiles) { const cache = this._fileTshs.get(path); if (cache !== undefined) { @@ -2065,11 +2008,7 @@ class FileSystemInfo { } break; case 2: - unsharedFileHashes = this._fileHashesOptimization.optimize( - capturedFiles, - undefined, - children - ); + this._fileHashesOptimization.optimize(snapshot, capturedFiles); for (const path of capturedFiles) { const cache = this._fileHashes.get(path); if (cache !== undefined) { @@ -2093,11 +2032,7 @@ class FileSystemInfo { } break; case 1: - unsharedFileTimestamps = this._fileTimestampsOptimization.optimize( - capturedFiles, - startTime, - children - ); + this._fileTimestampsOptimization.optimize(snapshot, capturedFiles); for (const path of capturedFiles) { const cache = this._fileTimestamps.get(path); if (cache !== undefined) { @@ -2131,11 +2066,7 @@ class FileSystemInfo { ); switch (mode) { case 3: - unsharedContextTshs = this._contextTshsOptimization.optimize( - capturedDirectories, - undefined, - children - ); + this._contextTshsOptimization.optimize(snapshot, capturedDirectories); for (const path of capturedDirectories) { const cache = this._contextTshs.get(path); let resolved; @@ -2168,10 +2099,9 @@ class FileSystemInfo { } break; case 2: - unsharedContextHashes = this._contextHashesOptimization.optimize( - capturedDirectories, - undefined, - children + this._contextHashesOptimization.optimize( + snapshot, + capturedDirectories ); for (const path of capturedDirectories) { const cache = this._contextHashes.get(path); @@ -2205,12 +2135,10 @@ class FileSystemInfo { } break; case 1: - unsharedContextTimestamps = - this._contextTimestampsOptimization.optimize( - capturedDirectories, - startTime, - children - ); + this._contextTimestampsOptimization.optimize( + snapshot, + capturedDirectories + ); for (const path of capturedDirectories) { const cache = this._contextTimestamps.get(path); let resolved; @@ -2246,11 +2174,7 @@ class FileSystemInfo { } if (missing) { const capturedMissing = captureNonManaged(missing, managedMissing); - unsharedMissingExistence = this._missingExistenceOptimization.optimize( - capturedMissing, - startTime, - children - ); + this._missingExistenceOptimization.optimize(snapshot, capturedMissing); for (const path of capturedMissing) { const cache = this._fileTimestamps.get(path); if (cache !== undefined) { @@ -2275,11 +2199,7 @@ class FileSystemInfo { } } } - unsharedManagedItemInfo = this._managedItemInfoOptimization.optimize( - managedItems, - undefined, - children - ); + this._managedItemInfoOptimization.optimize(snapshot, managedItems); for (const path of managedItems) { const cache = this._managedItems.get(path); if (cache !== undefined) { From 18ed9cb34b8c328f37f2374cc5ceb9e497219b74 Mon Sep 17 00:00:00 2001 From: Ivan Kopeykin Date: Thu, 16 Sep 2021 13:15:01 +0300 Subject: [PATCH 02/34] fix logic expression evaluation --- lib/javascript/JavascriptParser.js | 12 ++++++++---- test/cases/parsing/issue-7519/a.js | 12 ++++++++++++ test/cases/parsing/issue-7519/index.js | 24 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 test/cases/parsing/issue-7519/a.js create mode 100644 test/cases/parsing/issue-7519/index.js diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index f2d600c99b8..a70ad7cae9e 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -417,23 +417,27 @@ class JavascriptParser extends Parser { const left = this.evaluateExpression(expr.left); if (!left) return; + let keepRight; if (expr.operator === "&&") { const leftAsBool = left.asBool(); if (leftAsBool === false) return left.setRange(expr.range); - if (leftAsBool !== true) return; + keepRight = leftAsBool === true; } else if (expr.operator === "||") { const leftAsBool = left.asBool(); if (leftAsBool === true) return left.setRange(expr.range); - if (leftAsBool !== false) return; + keepRight = leftAsBool === false; } else if (expr.operator === "??") { const leftAsNullish = left.asNullish(); if (leftAsNullish === false) return left.setRange(expr.range); - if (leftAsNullish !== true) return; + keepRight = leftAsNullish === true; } else return; const right = this.evaluateExpression(expr.right); if (!right) return; if (left.couldHaveSideEffects()) right.setSideEffects(); - return right.setRange(expr.range); + + if (typeof right.asBool() === "boolean" || keepRight) { + return right.setRange(expr.range); + } }); const valueAsExpression = (value, expr, sideEffects) => { diff --git a/test/cases/parsing/issue-7519/a.js b/test/cases/parsing/issue-7519/a.js new file mode 100644 index 00000000000..6793f0b0bf2 --- /dev/null +++ b/test/cases/parsing/issue-7519/a.js @@ -0,0 +1,12 @@ +export let count = 1; + +export function inc() { + count++; +} + +export function mult(n) { + count *= n; +} + +export const multUsed = __webpack_exports_info__.mult.used; +export const incUsed = __webpack_exports_info__.inc.used; diff --git a/test/cases/parsing/issue-7519/index.js b/test/cases/parsing/issue-7519/index.js new file mode 100644 index 00000000000..c6aa510eb3b --- /dev/null +++ b/test/cases/parsing/issue-7519/index.js @@ -0,0 +1,24 @@ +import { + count, + mult, + inc, + multUsed, + incUsed +} from "./a"; + +it("simple logical expression should work", () => { + inc() && true && false && mult(2); + expect(count).toBe(2); + inc() && false && mult(2); + expect(count).toBe(3); + true && inc() && false && mult(2); + expect(count).toBe(4); +}); + +it("mult should not be used", () => { + if (inc() && true && false) { + mult(2); + } + + expect(multUsed).toBe(false); +}); From 7148a0af22b84625070503190d14af10e1768637 Mon Sep 17 00:00:00 2001 From: Ivan Kopeykin Date: Thu, 16 Sep 2021 14:35:39 +0300 Subject: [PATCH 03/34] fix test case --- test/cases/parsing/issue-7519/test.filter.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test/cases/parsing/issue-7519/test.filter.js diff --git a/test/cases/parsing/issue-7519/test.filter.js b/test/cases/parsing/issue-7519/test.filter.js new file mode 100644 index 00000000000..9022ab6415f --- /dev/null +++ b/test/cases/parsing/issue-7519/test.filter.js @@ -0,0 +1,3 @@ +module.exports = function(config) { + return config.mode !== "development"; +}; From 1b2c08a672bec82572dacd5711bdfaaa000b867c Mon Sep 17 00:00:00 2001 From: Ivan Kopeykin Date: Fri, 17 Sep 2021 07:23:29 +0300 Subject: [PATCH 04/34] fix discussions --- lib/DefinePlugin.js | 2 +- lib/javascript/BasicEvaluatedExpression.js | 25 ++++++++++---- lib/javascript/JavascriptParser.js | 39 ++++++++++++++++------ lib/javascript/JavascriptParserHelpers.js | 7 ++-- 4 files changed, 51 insertions(+), 22 deletions(-) diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js index e478930b85f..44b91c8fd4e 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -497,7 +497,7 @@ class DefinePlugin { .tap("DefinePlugin", expr => { addValueDependency(key); return new BasicEvaluatedExpression() - .setTruthy() + .setTruthy(true) .setSideEffects(false) .setRange(expr.range); }); diff --git a/lib/javascript/BasicEvaluatedExpression.js b/lib/javascript/BasicEvaluatedExpression.js index 6177a83a861..e85b56ba236 100644 --- a/lib/javascript/BasicEvaluatedExpression.js +++ b/lib/javascript/BasicEvaluatedExpression.js @@ -402,16 +402,27 @@ class BasicEvaluatedExpression { return this; } - setTruthy() { - this.falsy = false; - this.truthy = true; - this.nullish = false; + /** + * @param {boolean} state state + * @returns {BasicEvaluatedExpression} this + */ + setTruthy(state) { + this.falsy = !state; + this.truthy = state; + + if (state) { + this.nullish = false; + } return this; } - setFalsy() { - this.falsy = true; - this.truthy = false; + /** + * @param {boolean} state state + * @returns {BasicEvaluatedExpression} this + */ + setFalsy(state) { + this.falsy = state; + this.truthy = !state; return this; } diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index a70ad7cae9e..49ba4de920d 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -333,19 +333,23 @@ class JavascriptParser extends Parser { case "number": return new BasicEvaluatedExpression() .setNumber(expr.value) - .setRange(expr.range); + .setRange(expr.range) + .setFalsy(expr.value === 0); case "bigint": return new BasicEvaluatedExpression() .setBigInt(expr.value) - .setRange(expr.range); + .setRange(expr.range) + .setFalsy(expr.value === BigInt(0)); case "string": return new BasicEvaluatedExpression() .setString(expr.value) - .setRange(expr.range); + .setRange(expr.range) + .setFalsy(expr.value === ""); case "boolean": return new BasicEvaluatedExpression() .setBoolean(expr.value) - .setRange(expr.range); + .setRange(expr.range) + .setFalsy(expr.value === false); } if (expr.value === null) { return new BasicEvaluatedExpression().setNull().setRange(expr.range); @@ -417,26 +421,41 @@ class JavascriptParser extends Parser { const left = this.evaluateExpression(expr.left); if (!left) return; - let keepRight; + let returnRight; + /** @type {boolean|null} */ + let allowedRight; if (expr.operator === "&&") { const leftAsBool = left.asBool(); if (leftAsBool === false) return left.setRange(expr.range); - keepRight = leftAsBool === true; + returnRight = leftAsBool === true; + allowedRight = false; } else if (expr.operator === "||") { const leftAsBool = left.asBool(); if (leftAsBool === true) return left.setRange(expr.range); - keepRight = leftAsBool === false; + returnRight = leftAsBool === false; + allowedRight = true; } else if (expr.operator === "??") { const leftAsNullish = left.asNullish(); if (leftAsNullish === false) return left.setRange(expr.range); - keepRight = leftAsNullish === true; + returnRight = leftAsNullish === true; } else return; const right = this.evaluateExpression(expr.right); if (!right) return; if (left.couldHaveSideEffects()) right.setSideEffects(); + if (returnRight) return right.setRange(expr.range); - if (typeof right.asBool() === "boolean" || keepRight) { - return right.setRange(expr.range); + const asBool = right.asBool(); + + if (allowedRight === true && asBool === true) { + return new BasicEvaluatedExpression() + .setRange(expr.range) + .setExpression(expr) + .setTruthy(true); + } else if (allowedRight === false && asBool === false) { + return new BasicEvaluatedExpression() + .setRange(expr.range) + .setExpression(expr) + .setFalsy(true); } }); diff --git a/lib/javascript/JavascriptParserHelpers.js b/lib/javascript/JavascriptParserHelpers.js index 3a960d69c10..64ce6b5cd25 100644 --- a/lib/javascript/JavascriptParserHelpers.js +++ b/lib/javascript/JavascriptParserHelpers.js @@ -75,15 +75,14 @@ exports.evaluateToIdentifier = (identifier, rootInfo, getMembers, truthy) => { .setRange(expr.range); switch (truthy) { case true: - evaluatedExpression.setTruthy(); - evaluatedExpression.setNullish(false); + evaluatedExpression.setTruthy(true); break; case null: - evaluatedExpression.setFalsy(); + evaluatedExpression.setFalsy(true); evaluatedExpression.setNullish(true); break; case false: - evaluatedExpression.setFalsy(); + evaluatedExpression.setFalsy(true); break; } From 1ca241159c7c0e0a460ab2dc6184feed4162fc30 Mon Sep 17 00:00:00 2001 From: Ivan Kopeykin Date: Fri, 17 Sep 2021 08:27:58 +0300 Subject: [PATCH 05/34] fix lint --- types.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types.d.ts b/types.d.ts index 0d0634b6b2c..dbd30a2a564 100644 --- a/types.d.ts +++ b/types.d.ts @@ -531,8 +531,8 @@ declare abstract class BasicEvaluatedExpression { kind?: any ): BasicEvaluatedExpression; templateStringKind: any; - setTruthy(): BasicEvaluatedExpression; - setFalsy(): BasicEvaluatedExpression; + setTruthy(state: boolean): BasicEvaluatedExpression; + setFalsy(state: boolean): BasicEvaluatedExpression; setNullish(value?: any): BasicEvaluatedExpression; setRange(range?: any): BasicEvaluatedExpression; setSideEffects(sideEffects?: boolean): BasicEvaluatedExpression; From 4a4593ac9912c52956165ac34e83d8c13b08c062 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 02:01:56 +0000 Subject: [PATCH 06/34] chore(deps-dev): bump coffeescript from 2.5.1 to 2.6.0 Bumps [coffeescript](https://github.com/jashkenas/coffeescript) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/jashkenas/coffeescript/releases) - [Commits](https://github.com/jashkenas/coffeescript/compare/2.5.1...2.6.0) --- updated-dependencies: - dependency-name: coffeescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ca06e0ffe9c..d2c997b00cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1761,9 +1761,9 @@ coffee-loader@^1.0.0: schema-utils "^3.0.0" coffeescript@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-2.5.1.tgz#b2442a1f2c806139669534a54adc35010559d16a" - integrity sha512-J2jRPX0eeFh5VKyVnoLrfVFgLZtnnmp96WQSLAS8OrLm2wtQLcnikYKe1gViJKDH7vucjuhHvBKKBP3rKcD1tQ== + version "2.6.0" + resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-2.6.0.tgz#927d52aa03df17d445c93c1afb66b081d26e1fa0" + integrity sha512-gCGXhR72sTAdEr+oZh3FcOj04DrcMc9lZYSJUBNudkQ4tQXuPKE3cvcYVbK/HiVW+zFzLmnZdHexuJ33ufLZOg== collect-v8-coverage@^1.0.0: version "1.0.1" From 9a4706043e791c2a8b5046b3afb794f294f0791b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 02:03:25 +0000 Subject: [PATCH 07/34] chore(deps): bump es-module-lexer from 0.7.1 to 0.9.0 Bumps [es-module-lexer](https://github.com/guybedford/es-module-lexer) from 0.7.1 to 0.9.0. - [Release notes](https://github.com/guybedford/es-module-lexer/releases) - [Changelog](https://github.com/guybedford/es-module-lexer/blob/main/CHANGELOG.md) - [Commits](https://github.com/guybedford/es-module-lexer/compare/0.7.1...0.9.0) --- updated-dependencies: - dependency-name: es-module-lexer dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c9b6e5026be..01ee0ee60be 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.8.0", - "es-module-lexer": "^0.7.1", + "es-module-lexer": "^0.9.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", diff --git a/yarn.lock b/yarn.lock index ca06e0ffe9c..de183b3cd49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2276,10 +2276,10 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-module-lexer@*, es-module-lexer@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.7.1.tgz#c2c8e0f46f2df06274cdaf0dd3f3b33e0a0b267d" - integrity sha512-MgtWFl5No+4S3TmhDmCz2ObFGm6lEpTnzbQi+Dd+pw4mlTIZTmM2iAs5gRlmx5zS9luzobCSBSI90JM/1/JgOw== +es-module-lexer@*, es-module-lexer@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.0.tgz#fe4c4621977bc668e285c5f1f70ca3b451095fda" + integrity sha512-qU2eN/XHsrl3E4y7mK1wdWnyy5c8gXtCbfP6Xcsemm7fPUR1PIV1JhZfP7ojcN0Fzp69CfrS3u76h2tusvfKiQ== es5-ext@^0.10.35, es5-ext@^0.10.45, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.51, es5-ext@^0.10.53, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: version "0.10.53" From ffad02dbe2cf865568312161e2cc061d2c186891 Mon Sep 17 00:00:00 2001 From: Ivan Kopeykin Date: Mon, 20 Sep 2021 15:38:42 +0300 Subject: [PATCH 08/34] fix discussions --- lib/DefinePlugin.js | 2 +- lib/javascript/BasicEvaluatedExpression.js | 28 +++++++----------- lib/javascript/JavascriptParser.js | 33 +++++++++------------- lib/javascript/JavascriptParserHelpers.js | 5 ++-- types.d.ts | 4 +-- 5 files changed, 29 insertions(+), 43 deletions(-) diff --git a/lib/DefinePlugin.js b/lib/DefinePlugin.js index 44b91c8fd4e..e478930b85f 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -497,7 +497,7 @@ class DefinePlugin { .tap("DefinePlugin", expr => { addValueDependency(key); return new BasicEvaluatedExpression() - .setTruthy(true) + .setTruthy() .setSideEffects(false) .setRange(expr.range); }); diff --git a/lib/javascript/BasicEvaluatedExpression.js b/lib/javascript/BasicEvaluatedExpression.js index e85b56ba236..0e5a21183c9 100644 --- a/lib/javascript/BasicEvaluatedExpression.js +++ b/lib/javascript/BasicEvaluatedExpression.js @@ -402,32 +402,24 @@ class BasicEvaluatedExpression { return this; } - /** - * @param {boolean} state state - * @returns {BasicEvaluatedExpression} this - */ - setTruthy(state) { - this.falsy = !state; - this.truthy = state; - - if (state) { - this.nullish = false; - } + setTruthy() { + this.falsy = false; + this.truthy = true; + this.nullish = false; return this; } - /** - * @param {boolean} state state - * @returns {BasicEvaluatedExpression} this - */ - setFalsy(state) { - this.falsy = state; - this.truthy = !state; + setFalsy() { + this.falsy = true; + this.truthy = false; return this; } setNullish(value) { this.nullish = value; + + if (value) return this.setFalsy(); + return this; } diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index 49ba4de920d..5f98c8b3267 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -333,23 +333,19 @@ class JavascriptParser extends Parser { case "number": return new BasicEvaluatedExpression() .setNumber(expr.value) - .setRange(expr.range) - .setFalsy(expr.value === 0); + .setRange(expr.range); case "bigint": return new BasicEvaluatedExpression() .setBigInt(expr.value) - .setRange(expr.range) - .setFalsy(expr.value === BigInt(0)); + .setRange(expr.range); case "string": return new BasicEvaluatedExpression() .setString(expr.value) - .setRange(expr.range) - .setFalsy(expr.value === ""); + .setRange(expr.range); case "boolean": return new BasicEvaluatedExpression() .setBoolean(expr.value) - .setRange(expr.range) - .setFalsy(expr.value === false); + .setRange(expr.range); } if (expr.value === null) { return new BasicEvaluatedExpression().setNull().setRange(expr.range); @@ -421,8 +417,8 @@ class JavascriptParser extends Parser { const left = this.evaluateExpression(expr.left); if (!left) return; - let returnRight; - /** @type {boolean|null} */ + let returnRight = false; + /** @type {boolean|undefined} */ let allowedRight; if (expr.operator === "&&") { const leftAsBool = left.asBool(); @@ -437,25 +433,24 @@ class JavascriptParser extends Parser { } else if (expr.operator === "??") { const leftAsNullish = left.asNullish(); if (leftAsNullish === false) return left.setRange(expr.range); - returnRight = leftAsNullish === true; + if (leftAsNullish !== true) return; + returnRight = true; } else return; const right = this.evaluateExpression(expr.right); if (!right) return; - if (left.couldHaveSideEffects()) right.setSideEffects(); - if (returnRight) return right.setRange(expr.range); + if (returnRight) { + if (left.couldHaveSideEffects()) right.setSideEffects(); + return right.setRange(expr.range); + } const asBool = right.asBool(); if (allowedRight === true && asBool === true) { return new BasicEvaluatedExpression() .setRange(expr.range) - .setExpression(expr) - .setTruthy(true); + .setTruthy(); } else if (allowedRight === false && asBool === false) { - return new BasicEvaluatedExpression() - .setRange(expr.range) - .setExpression(expr) - .setFalsy(true); + return new BasicEvaluatedExpression().setRange(expr.range).setFalsy(); } }); diff --git a/lib/javascript/JavascriptParserHelpers.js b/lib/javascript/JavascriptParserHelpers.js index 64ce6b5cd25..fc1dea816ac 100644 --- a/lib/javascript/JavascriptParserHelpers.js +++ b/lib/javascript/JavascriptParserHelpers.js @@ -75,14 +75,13 @@ exports.evaluateToIdentifier = (identifier, rootInfo, getMembers, truthy) => { .setRange(expr.range); switch (truthy) { case true: - evaluatedExpression.setTruthy(true); + evaluatedExpression.setTruthy(); break; case null: - evaluatedExpression.setFalsy(true); evaluatedExpression.setNullish(true); break; case false: - evaluatedExpression.setFalsy(true); + evaluatedExpression.setFalsy(); break; } diff --git a/types.d.ts b/types.d.ts index dbd30a2a564..0d0634b6b2c 100644 --- a/types.d.ts +++ b/types.d.ts @@ -531,8 +531,8 @@ declare abstract class BasicEvaluatedExpression { kind?: any ): BasicEvaluatedExpression; templateStringKind: any; - setTruthy(state: boolean): BasicEvaluatedExpression; - setFalsy(state: boolean): BasicEvaluatedExpression; + setTruthy(): BasicEvaluatedExpression; + setFalsy(): BasicEvaluatedExpression; setNullish(value?: any): BasicEvaluatedExpression; setRange(range?: any): BasicEvaluatedExpression; setSideEffects(sideEffects?: boolean): BasicEvaluatedExpression; From 15393ca45978c126d5c2ab7e3ad0a0db25b59278 Mon Sep 17 00:00:00 2001 From: Ivan Kopeykin Date: Mon, 20 Sep 2021 15:54:09 +0300 Subject: [PATCH 09/34] more complex test case --- test/cases/parsing/issue-7519/a.js | 10 +++++++++- test/cases/parsing/issue-7519/index.js | 20 +++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/test/cases/parsing/issue-7519/a.js b/test/cases/parsing/issue-7519/a.js index 6793f0b0bf2..3df259fa7ba 100644 --- a/test/cases/parsing/issue-7519/a.js +++ b/test/cases/parsing/issue-7519/a.js @@ -4,9 +4,17 @@ export function inc() { count++; } +export function incTruthy() { + count++; + return true; +} + export function mult(n) { count *= n; } +export function setCount(c) { + count = c; +} + export const multUsed = __webpack_exports_info__.mult.used; -export const incUsed = __webpack_exports_info__.inc.used; diff --git a/test/cases/parsing/issue-7519/index.js b/test/cases/parsing/issue-7519/index.js index c6aa510eb3b..2c25bebe550 100644 --- a/test/cases/parsing/issue-7519/index.js +++ b/test/cases/parsing/issue-7519/index.js @@ -2,16 +2,30 @@ import { count, mult, inc, + incTruthy, + setCount, multUsed, incUsed } from "./a"; -it("simple logical expression should work", () => { - inc() && true && false && mult(2); +it("logical 'and' should work", () => { + setCount(1); + inc() && "true" && 0 && mult(2); expect(count).toBe(2); inc() && false && mult(2); expect(count).toBe(3); - true && inc() && false && mult(2); + true && inc() && inc() && false && mult(2); + /* inc itself returns undefined */ + expect(count).toBe(4); + true && incTruthy() && incTruthy() && false && mult(2); + expect(count).toBe(6); +}); + +it("logical 'or' should work", () => { + setCount(1); + false || "" || inc(); + expect(count).toBe(2); + (0 || "" || inc() || inc()) && false && mult(2); expect(count).toBe(4); }); From 18ee3fb1a9b207cab5dc53ceeb0bd170015fb98f Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 20 Sep 2021 12:26:18 +0200 Subject: [PATCH 10/34] avoid bailout of unused eval expose InnerGraph and runtime utils --- lib/JavascriptMetaInfoPlugin.js | 7 +- lib/index.js | 6 + lib/optimize/InnerGraph.js | 24 +++- .../inner-graph/eval-bailout/module.js | 15 +++ .../eval-bailout/webpack.config.js | 27 +++++ types.d.ts | 111 +++++++++++++++++- 6 files changed, 185 insertions(+), 5 deletions(-) create mode 100644 test/configCases/inner-graph/eval-bailout/module.js create mode 100644 test/configCases/inner-graph/eval-bailout/webpack.config.js diff --git a/lib/JavascriptMetaInfoPlugin.js b/lib/JavascriptMetaInfoPlugin.js index 3eb7f48fc72..e09d0674905 100644 --- a/lib/JavascriptMetaInfoPlugin.js +++ b/lib/JavascriptMetaInfoPlugin.js @@ -28,7 +28,12 @@ class JavascriptMetaInfoPlugin { parser.hooks.call.for("eval").tap("JavascriptMetaInfoPlugin", () => { parser.state.module.buildInfo.moduleConcatenationBailout = "eval()"; parser.state.module.buildInfo.usingEval = true; - InnerGraph.bailout(parser.state); + const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state); + if (currentSymbol) { + InnerGraph.addUsage(parser.state, null, currentSymbol); + } else { + InnerGraph.bailout(parser.state); + } }); parser.hooks.finish.tap("JavascriptMetaInfoPlugin", () => { let topLevelDeclarations = diff --git a/lib/index.js b/lib/index.js index 91146933d9f..dbe5cca06d4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -394,6 +394,9 @@ module.exports = mergeExports(fn, { "DEP_WEBPACK_AGGRESSIVE_SPLITTING_PLUGIN" )(); }, + get InnerGraph() { + return require("./optimize/InnerGraph"); + }, get LimitChunkCountPlugin() { return require("./optimize/LimitChunkCountPlugin"); }, @@ -535,6 +538,9 @@ module.exports = mergeExports(fn, { get comparators() { return require("./util/comparators"); }, + get runtime() { + return require("./util/runtime"); + }, get serialization() { return require("./util/serialization"); }, diff --git a/lib/optimize/InnerGraph.js b/lib/optimize/InnerGraph.js index 413407b7f04..8931bc31c25 100644 --- a/lib/optimize/InnerGraph.js +++ b/lib/optimize/InnerGraph.js @@ -16,7 +16,7 @@ const { UsageState } = require("../ExportsInfo"); /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ -/** @typedef {Map | true>} InnerGraph */ +/** @typedef {Map | true>} InnerGraph */ /** @typedef {function(boolean | Set | undefined): void} UsageCallback */ /** @@ -75,7 +75,7 @@ exports.isEnabled = parserState => { /** * @param {ParserState} state parser state - * @param {TopLevelSymbol} symbol the symbol + * @param {TopLevelSymbol | null} symbol the symbol, or null for all symbols * @param {string | TopLevelSymbol | true} usage usage data * @returns {void} */ @@ -172,6 +172,26 @@ exports.inferDependencyUsage = state => { } if (isTerminal) { nonTerminal.delete(key); + + // For the global key, merge with all other keys + if (key === null) { + const globalValue = innerGraph.get(null); + if (globalValue) { + for (const [key, value] of innerGraph) { + if (key !== null && value !== true) { + if (globalValue === true) { + innerGraph.set(key, true); + } else { + const newSet = new Set(value); + for (const item of globalValue) { + newSet.add(item); + } + innerGraph.set(key, newSet); + } + } + } + } + } } } } diff --git a/test/configCases/inner-graph/eval-bailout/module.js b/test/configCases/inner-graph/eval-bailout/module.js new file mode 100644 index 00000000000..ce9787c2da5 --- /dev/null +++ b/test/configCases/inner-graph/eval-bailout/module.js @@ -0,0 +1,15 @@ +import { a, b, c } from "./test"; + +export function x() { + a(); +} + +export function y() { + b(); + eval("x()"); +} + +export function z() { + c(); + y(); +} diff --git a/test/configCases/inner-graph/eval-bailout/webpack.config.js b/test/configCases/inner-graph/eval-bailout/webpack.config.js new file mode 100644 index 00000000000..5953593079c --- /dev/null +++ b/test/configCases/inner-graph/eval-bailout/webpack.config.js @@ -0,0 +1,27 @@ +const createTestCases = require("../_helpers/createTestCases"); +module.exports = createTestCases({ + nothing: { + usedExports: [], + expect: { + "./test": [] + } + }, + nonEval: { + usedExports: ["x"], + expect: { + "./test": ["a"] + } + }, + directEval: { + usedExports: ["y"], + expect: { + "./test": ["a", "b", "c"] + } + }, + indirectEval: { + usedExports: ["z"], + expect: { + "./test": ["a", "b", "c"] + } + } +}); diff --git a/types.d.ts b/types.d.ts index 0d0634b6b2c..32cc9cb2041 100644 --- a/types.d.ts +++ b/types.d.ts @@ -9783,6 +9783,7 @@ declare class RuntimeChunkPlugin { */ apply(compiler: Compiler): void; } +type RuntimeCondition = undefined | string | boolean | SortableSet; declare class RuntimeModule extends Module { constructor(name: string, stage?: number); name: string; @@ -9829,7 +9830,8 @@ declare interface RuntimeRequirementsContext { codeGenerationResults: CodeGenerationResults; } type RuntimeSpec = undefined | string | SortableSet; -declare abstract class RuntimeSpecMap { +declare class RuntimeSpecMap { + constructor(clone?: RuntimeSpecMap); get(runtime: RuntimeSpec): T; has(runtime: RuntimeSpec): boolean; set(runtime?: any, value?: any): void; @@ -9840,7 +9842,8 @@ declare abstract class RuntimeSpecMap { values(): IterableIterator; readonly size?: number; } -declare abstract class RuntimeSpecSet { +declare class RuntimeSpecSet { + constructor(iterable?: any); add(runtime?: any): void; has(runtime?: any): boolean; [Symbol.iterator](): IterableIterator; @@ -11299,6 +11302,10 @@ declare interface TimestampAndHash { timestamp?: number; hash: string; } +declare class TopLevelSymbol { + constructor(name: string); + name: string; +} /** * Use a Trusted Types policy to create urls for chunks. @@ -12142,6 +12149,52 @@ declare namespace exports { }; } export namespace optimize { + export namespace InnerGraph { + export let bailout: (parserState: ParserState) => void; + export let enable: (parserState: ParserState) => void; + export let isEnabled: (parserState: ParserState) => boolean; + export let addUsage: ( + state: ParserState, + symbol: null | TopLevelSymbol, + usage: string | true | TopLevelSymbol + ) => void; + export let addVariableUsage: ( + parser: JavascriptParser, + name: string, + usage: string | true | TopLevelSymbol + ) => void; + export let inferDependencyUsage: (state: ParserState) => void; + export let onUsage: ( + state: ParserState, + onUsageCallback: (arg0?: boolean | Set) => void + ) => void; + export let setTopLevelSymbol: ( + state: ParserState, + symbol: TopLevelSymbol + ) => void; + export let getTopLevelSymbol: ( + state: ParserState + ) => void | TopLevelSymbol; + export let tagTopLevelSymbol: ( + parser: JavascriptParser, + name: string + ) => TopLevelSymbol; + export let isDependencyUsedByExports: ( + dependency: Dependency, + usedByExports: boolean | Set, + moduleGraph: ModuleGraph, + runtime: RuntimeSpec + ) => boolean; + export let getDependencyUsedByExportsCondition: ( + dependency: Dependency, + usedByExports: boolean | Set, + moduleGraph: ModuleGraph + ) => + | null + | false + | ((arg0: ModuleGraphConnection, arg1: RuntimeSpec) => ConnectionState); + export { TopLevelSymbol, topLevelSymbolTag }; + } export { AggressiveMergingPlugin, AggressiveSplittingPlugin, @@ -12267,6 +12320,59 @@ declare namespace exports { b: DependencyLocation ) => 0 | 1 | -1; } + export namespace runtime { + export let getEntryRuntime: ( + compilation: Compilation, + name: string, + options?: EntryOptions + ) => RuntimeSpec; + export let forEachRuntime: ( + runtime: RuntimeSpec, + fn: (arg0: string) => void, + deterministicOrder?: boolean + ) => void; + export let getRuntimeKey: (runtime: RuntimeSpec) => string; + export let keyToRuntime: (key: string) => RuntimeSpec; + export let runtimeToString: (runtime: RuntimeSpec) => string; + export let runtimeConditionToString: ( + runtimeCondition: RuntimeCondition + ) => string; + export let runtimeEqual: (a: RuntimeSpec, b: RuntimeSpec) => boolean; + export let compareRuntime: (a: RuntimeSpec, b: RuntimeSpec) => 0 | 1 | -1; + export let mergeRuntime: (a: RuntimeSpec, b: RuntimeSpec) => RuntimeSpec; + export let mergeRuntimeCondition: ( + a: RuntimeCondition, + b: RuntimeCondition, + runtime: RuntimeSpec + ) => RuntimeCondition; + export let mergeRuntimeConditionNonFalse: ( + a: undefined | string | true | SortableSet, + b: undefined | string | true | SortableSet, + runtime: RuntimeSpec + ) => undefined | string | true | SortableSet; + export let mergeRuntimeOwned: ( + a: RuntimeSpec, + b: RuntimeSpec + ) => RuntimeSpec; + export let intersectRuntime: ( + a: RuntimeSpec, + b: RuntimeSpec + ) => RuntimeSpec; + export let subtractRuntime: ( + a: RuntimeSpec, + b: RuntimeSpec + ) => RuntimeSpec; + export let subtractRuntimeCondition: ( + a: RuntimeCondition, + b: RuntimeCondition, + runtime: RuntimeSpec + ) => RuntimeCondition; + export let filterRuntime: ( + runtime: RuntimeSpec, + filter: (arg0: RuntimeSpec) => boolean + ) => undefined | string | boolean | SortableSet; + export { RuntimeSpecMap, RuntimeSpecSet }; + } export namespace serialization { export const register: ( Constructor: Constructor, @@ -12409,5 +12515,6 @@ declare namespace exports { LoaderContext }; } +declare const topLevelSymbolTag: unique symbol; export = exports; From 4e213e13236977410368332add88d423fef7d376 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Sep 2021 02:03:43 +0000 Subject: [PATCH 11/34] chore(deps): bump browserslist from 4.16.8 to 4.17.1 Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.8 to 4.17.1. - [Release notes](https://github.com/browserslist/browserslist/releases) - [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserslist/browserslist/compare/4.16.8...4.17.1) --- updated-dependencies: - dependency-name: browserslist dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- yarn.lock | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/yarn.lock b/yarn.lock index c46afdcee38..b6a94328141 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1551,15 +1551,15 @@ browser-process-hrtime@^1.0.0: integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== browserslist@^4.14.5, browserslist@^4.16.6: - version "4.16.8" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.8.tgz#cb868b0b554f137ba6e33de0ecff2eda403c4fb0" - integrity sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ== + version "4.17.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.17.1.tgz#a98d104f54af441290b7d592626dd541fa642eb9" + integrity sha512-aLD0ZMDSnF4lUt4ZDNgqi5BUn9BZ7YdQdI/cYlILrhdSSZJLU9aNZoD5/NBmM4SK34APB2e83MOsRt1EnkuyaQ== dependencies: - caniuse-lite "^1.0.30001251" - colorette "^1.3.0" - electron-to-chromium "^1.3.811" + caniuse-lite "^1.0.30001259" + electron-to-chromium "^1.3.846" escalade "^3.1.1" - node-releases "^1.1.75" + nanocolors "^0.1.5" + node-releases "^1.1.76" bser@2.1.1: version "2.1.1" @@ -1619,10 +1619,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -caniuse-lite@^1.0.30001251: - version "1.0.30001252" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001252.tgz#cb16e4e3dafe948fc4a9bb3307aea054b912019a" - integrity sha512-I56jhWDGMtdILQORdusxBOH+Nl/KgQSdDmpJezYddnAkVOmnoU8zwjTV9xAjMIYxr0iPreEAVylCGcmHCjfaOw== +caniuse-lite@^1.0.30001259: + version "1.0.30001259" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz#ae21691d3da9c4be6144403ac40f71d9f6efd790" + integrity sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg== caseless@~0.12.0: version "0.12.0" @@ -1794,7 +1794,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^1.2.1, colorette@^1.2.2, colorette@^1.3.0: +colorette@^1.2.1, colorette@^1.2.2: version "1.3.0" resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.3.0.tgz#ff45d2f0edb244069d3b772adeb04fed38d0a0af" integrity sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w== @@ -2213,10 +2213,10 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -electron-to-chromium@^1.3.811: - version "1.3.822" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.822.tgz#7036edc7f669b0aa79e9801dc5f56866c6ddc0b2" - integrity sha512-k7jG5oYYHxF4jx6PcqwHX3JVME/OjzolqOZiIogi9xtsfsmTjTdie4x88OakYFPEa8euciTgCCzvVNwvmjHb1Q== +electron-to-chromium@^1.3.846: + version "1.3.848" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.848.tgz#94cc196e496f33c0d71cd98561448f10018584cc" + integrity sha512-wchRyBcdcmibioggdO7CbMT5QQ4lXlN/g7Mkpf1K2zINidnqij6EVu94UIZ+h5nB2S9XD4bykqFv9LonAWLFyw== emittery@^0.8.1: version "0.8.1" @@ -4399,6 +4399,11 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" +nanocolors@^0.1.5: + version "0.1.6" + resolved "https://registry.yarnpkg.com/nanocolors/-/nanocolors-0.1.6.tgz#bc2350d3edfdbfadd7ac018c855ae7c13905a6ad" + integrity sha512-2pvTw6vYRaBLGir2xR7MxaJtyWkrn+C53EpW8yPotG+pdAwBvt0Xwk4VJ6VHLY0aLthVZPvDfm9TdZvrvAm5UQ== + nanoid@^3.1.23: version "3.1.23" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81" @@ -4450,10 +4455,10 @@ node-preload@^0.2.1: dependencies: process-on-spawn "^1.0.0" -node-releases@^1.1.75: - version "1.1.75" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.75.tgz#6dd8c876b9897a1b8e5a02de26afa79bb54ebbfe" - integrity sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw== +node-releases@^1.1.76: + version "1.1.76" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.76.tgz#df245b062b0cafbd5282ab6792f7dccc2d97f36e" + integrity sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA== nopt@3.x: version "3.0.6" From 4a8bf4c084f98bef8b47f0050c352f246ffb3527 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 22 Sep 2021 12:12:46 +0200 Subject: [PATCH 12/34] allow to configure all hash functions used fix default hash function for HttpUriPlugin to sha512 --- .../plugins/HashedModuleIdsPlugin.d.ts | 7 +- examples/build-http/README.md | 34 +-- examples/build-http/webpack.lock | 19 +- .../p-map_9a051b191b6af4b352ba | 3 - .../p-map_9dd32c023fd5f3d3e7f2 | 3 + ...15_aggregate-error_89888e7f244a2b227be9.js | 3 - ...es2015_clean-stack_512fad7a42bd85149e06.js | 3 - ...5.1.0_es2015_p-map_2e9e4310942f189ff123.js | 1 - ...15_aggregate-error_ff6bcc1ba33bf3b1810a.js | 4 + ...es2015_clean-stack_87b32b37ae264a8e8a1c.js | 4 + ...ape-string-regexp_2c814e466860133eca86.js} | 3 +- ...015_indent-string_171b2b5ba89965a085b6.js} | 3 +- ....0_es2015_browser_476a088316baaea08336.js} | 3 +- ...5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js | 2 + ...d_aggregate-error_12f7879e59421c0b09bf.js} | 0 ...mized_clean-stack_25e0e8c6773c790b5bc1.js} | 0 ...ape-string-regexp_95a4ae8a862c0536f335.js} | 0 ...zed_indent-string_c9ee21b059896b4e6290.js} | 0 ...1bb9acaf4be => p-map_85ed609042d47e169edd} | 0 ...s_optimized_p-map_ddf2a76b117954d701e6.js} | 0 ...ggregate-error_4.0_50f751f77af91e405af4.0} | 0 ...pm_aggregate-error_4_a354b9220c6e41b430f0} | 0 ...pm_clean-stack_4.1_b2805ba009abd32b0160.0} | 0 ...=> npm_clean-stack_4_760ca83301f78911741b} | 0 ...-string-regexp_5.0_703470061c4748c30ba2.0} | 0 ..._indent-string_5.0_39c50c3c56a92bbf73ba.0} | 0 ... npm_indent-string_5_01a4f4bd5c5dc36ce1b7} | 0 ...a_12b8110471722e74fcb6.11_nodelibs_process | 277 ++++++++++++++++++ ...-beta_1620e8f9e144fe702a06.11_nodelibs_os} | 52 ++-- ...pm_core_2_nodelibs_os_3fe9447e10c5fed754bb | 3 + ...pm_core_2_nodelibs_os_cf88df9df31061bcb921 | 2 - ...0 => npm_p-map_5.1_9895e1a83d37d06ab277.0} | 0 ...a5a6deb568e => p-map_875efed0b6bd20646dd2} | 0 ....0.0_index_module_cb329557880410b778cf.js} | 0 lib/CacheFacade.js | 13 +- lib/ChunkGraph.js | 10 +- lib/CodeGenerationResults.js | 9 +- lib/Compilation.js | 21 +- lib/Compiler.js | 6 +- lib/DependencyTemplates.js | 10 +- lib/EvalDevToolModulePlugin.js | 3 +- lib/EvalSourceMapDevToolPlugin.js | 3 +- lib/ExternalModule.js | 27 +- lib/FileSystemInfo.js | 31 +- lib/ModuleFilenameHelpers.js | 28 +- lib/SourceMapDevToolPlugin.js | 10 +- lib/WebpackOptionsApply.js | 4 +- lib/cache/PackFileCacheStrategy.js | 3 +- lib/cache/getLazyHashedEtag.js | 43 ++- lib/ids/IdHelpers.js | 29 +- lib/ids/NamedChunkIdsPlugin.js | 3 + lib/ids/NamedModuleIdsPlugin.js | 4 +- lib/optimize/ConcatenatedModule.js | 29 +- lib/optimize/ModuleConcatenationPlugin.js | 3 +- lib/schemes/HttpUriPlugin.js | 3 +- lib/serialization/FileMiddleware.js | 31 +- lib/serialization/ObjectMiddleware.js | 27 +- lib/util/serialization.js | 8 +- package.json | 2 +- .../plugins/HashedModuleIdsPlugin.check.js | 2 +- schemas/plugins/HashedModuleIdsPlugin.json | 22 +- test/FileSystemInfo.unittest.js | 3 +- ...643.txt => asset_72216076a225ea0abbaa.txt} | 0 ...t => asset_query_590ffbc5acc20bf1dc88.txt} | 0 ...02.js => fallback_4972219bd28762fbfd18.js} | 0 ...folder_dependency_3263dc642c8ad1171873.js} | 0 ...r_sub-dependency2_f750536150de4f4db445.js} | 0 ...er_sub-dependency_a662b3b186898f776088.js} | 0 ...s => index_cache_502725659b59ae63a82a.css} | 0 ...s => index_query_169a64b251bcdc02a084.css} | 0 ...91.js => redirect_d3dcf71bcf15dc29654c.js} | 0 ...458.js => resolve_69c3f44e55195d0c14cf.js} | 0 ...626dc87.js => url_cc93d527a81c32b07ab8.js} | 0 ...n_CODE_OF_CONDUCT_06e7b335922db99b918d.md} | 0 ...02.js => fallback_4972219bd28762fbfd18.js} | 0 ...s => index_query_169a64b251bcdc02a084.css} | 0 ...91.js => redirect_d3dcf71bcf15dc29654c.js} | 0 ...458.js => resolve_69c3f44e55195d0c14cf.js} | 0 ...n_CODE_OF_CONDUCT_06e7b335922db99b918d.md} | 0 ...643.txt => asset_72216076a225ea0abbaa.txt} | 0 ...t => asset_query_590ffbc5acc20bf1dc88.txt} | 0 ...02.js => fallback_4972219bd28762fbfd18.js} | 0 ...folder_dependency_3263dc642c8ad1171873.js} | 0 ...r_sub-dependency2_f750536150de4f4db445.js} | 0 ...er_sub-dependency_a662b3b186898f776088.js} | 0 .../index_cache_502725659b59ae63a82a.css} | 0 ...s => index_query_169a64b251bcdc02a084.css} | 0 ...91.js => redirect_d3dcf71bcf15dc29654c.js} | 0 ...458.js => resolve_69c3f44e55195d0c14cf.js} | 0 ...626dc87.js => url_cc93d527a81c32b07ab8.js} | 0 ...n_CODE_OF_CONDUCT_06e7b335922db99b918d.md} | 0 ...643.txt => asset_72216076a225ea0abbaa.txt} | 0 ...t => asset_query_590ffbc5acc20bf1dc88.txt} | 0 ...02.js => fallback_4972219bd28762fbfd18.js} | 0 ...folder_dependency_3263dc642c8ad1171873.js} | 0 ...r_sub-dependency2_f750536150de4f4db445.js} | 0 ...er_sub-dependency_a662b3b186898f776088.js} | 0 .../index_cache_502725659b59ae63a82a.css} | 0 .../index_query_004fef5280e02f70d9a7.css | 1 - ...s => index_query_169a64b251bcdc02a084.css} | 0 ...91.js => redirect_d3dcf71bcf15dc29654c.js} | 0 ...458.js => resolve_69c3f44e55195d0c14cf.js} | 0 ...626dc87.js => url_cc93d527a81c32b07ab8.js} | 0 ...n_CODE_OF_CONDUCT_06e7b335922db99b918d.md} | 0 types.d.ts | 28 +- yarn.lock | 6 +- 106 files changed, 674 insertions(+), 174 deletions(-) delete mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9a051b191b6af4b352ba create mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9dd32c023fd5f3d3e7f2 delete mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_aggregate-error_4.0.0_es2015_aggregate-error_89888e7f244a2b227be9.js delete mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_clean-stack_4.1.0_es2015_clean-stack_512fad7a42bd85149e06.js delete mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_p-map_5.1.0_es2015_p-map_2e9e4310942f189ff123.js create mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_aggregate-error_4.0.0_es2015_aggregate-error_ff6bcc1ba33bf3b1810a.js create mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_clean-stack_4.1.0_es2015_clean-stack_87b32b37ae264a8e8a1c.js rename examples/build-http/webpack.lock.data/https_cdn.esm.sh/{v43_escape-string-regexp_5.0.0_es2015_escape-string-regexp_22382d8d9f837184e161.js => v53_escape-string-regexp_5.0.0_es2015_escape-string-regexp_2c814e466860133eca86.js} (52%) rename examples/build-http/webpack.lock.data/https_cdn.esm.sh/{v43_indent-string_5.0.0_es2015_indent-string_6103e1cfb4ff573a03ed.js => v53_indent-string_5.0.0_es2015_indent-string_171b2b5ba89965a085b6.js} (50%) rename examples/build-http/webpack.lock.data/https_cdn.esm.sh/{v43_os-browserify_0.3.0_es2015_browser_92a2351b7a3273e492dd.js => v53_os-browserify_0.3.0_es2015_browser_476a088316baaea08336.js} (66%) create mode 100644 examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_p-map_5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js rename examples/build-http/webpack.lock.data/https_cdn.skypack.dev/{aggregate-error_v4.0.0-rCH8s5R9g4kQQ807o58j_dist_es2020_mode_imports_optimized_aggregate-error_779b7ff863afd770cb5e.js => aggregate-error_v4.0.0-rCH8s5R9g4kQQ807o58j_dist_es2020_mode_imports_optimized_aggregate-error_12f7879e59421c0b09bf.js} (100%) rename examples/build-http/webpack.lock.data/https_cdn.skypack.dev/{clean-stack_v4.1.0-DgWUKXHVzThBBZtsHXhC_dist_es2020_mode_imports_optimized_clean-stack_94a61d495a23573d704d.js => clean-stack_v4.1.0-DgWUKXHVzThBBZtsHXhC_dist_es2020_mode_imports_optimized_clean-stack_25e0e8c6773c790b5bc1.js} (100%) rename examples/build-http/webpack.lock.data/https_cdn.skypack.dev/{escape-string-regexp_v5.0.0-SUDdAhYOdAgXIYndxZss_dist_es2020_mode_imports_optimized_escape-string-regexp_c6f22ceb2f8b90740447.js => escape-string-regexp_v5.0.0-SUDdAhYOdAgXIYndxZss_dist_es2020_mode_imports_optimized_escape-string-regexp_95a4ae8a862c0536f335.js} (100%) rename examples/build-http/webpack.lock.data/https_cdn.skypack.dev/{indent-string_v5.0.0-VgKPSgi4hUX5NbF4n3aC_dist_es2020_mode_imports_optimized_indent-string_dc30873279e41ccf7b43.js => indent-string_v5.0.0-VgKPSgi4hUX5NbF4n3aC_dist_es2020_mode_imports_optimized_indent-string_c9ee21b059896b4e6290.js} (100%) rename examples/build-http/webpack.lock.data/https_cdn.skypack.dev/{p-map_f269386571bb9acaf4be => p-map_85ed609042d47e169edd} (100%) rename examples/build-http/webpack.lock.data/https_cdn.skypack.dev/{p-map_v5.1.0-7ixXvZxXPKKt9unR9LT0_dist_es2020_mode_imports_optimized_p-map_2f29b65de28b7340c85e.js => p-map_v5.1.0-7ixXvZxXPKKt9unR9LT0_dist_es2020_mode_imports_optimized_p-map_ddf2a76b117954d701e6.js} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_aggregate-error_4.0_3f9c2db11addffc62c35.0 => npm_aggregate-error_4.0_50f751f77af91e405af4.0} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_aggregate-error_4_2480c41192a10211937a => npm_aggregate-error_4_a354b9220c6e41b430f0} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_clean-stack_4.1_9c285d25bf0385cc2256.0 => npm_clean-stack_4.1_b2805ba009abd32b0160.0} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_clean-stack_4_3f532a3a3a391ea3d5d5 => npm_clean-stack_4_760ca83301f78911741b} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_escape-string-regexp_5.0_1a21bfa9008fa676b2a6.0 => npm_escape-string-regexp_5.0_703470061c4748c30ba2.0} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_indent-string_5.0_d9938d6e86a9a0febbeb.0 => npm_indent-string_5.0_39c50c3c56a92bbf73ba.0} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_indent-string_5_c2208743332044a73298 => npm_indent-string_5_01a4f4bd5c5dc36ce1b7} (100%) create mode 100644 examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_12b8110471722e74fcb6.11_nodelibs_process rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_jspm_core_2.0.0-beta_2b28d9456b8c8ef4d6fb.8_nodelibs_os => npm_jspm_core_2.0.0-beta_1620e8f9e144fe702a06.11_nodelibs_os} (65%) create mode 100644 examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_3fe9447e10c5fed754bb delete mode 100644 examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_cf88df9df31061bcb921 rename examples/build-http/webpack.lock.data/https_jspm.dev/{npm_p-map_5.1_bd0dfdcf7f62202ed19e.0 => npm_p-map_5.1_9895e1a83d37d06ab277.0} (100%) rename examples/build-http/webpack.lock.data/https_jspm.dev/{p-map_6fa685460a5a6deb568e => p-map_875efed0b6bd20646dd2} (100%) rename examples/build-http/webpack.lock.data/https_unpkg.com/{p-map-series_3.0.0_index_module_9660a252c7a76b957d99.js => p-map-series_3.0.0_index_module_cb329557880410b778cf.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{asset_46e6c8f1b2a5b24fb643.txt => asset_72216076a225ea0abbaa.txt} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{asset_query_36fd3967a266e1b0a996.txt => asset_query_590ffbc5acc20bf1dc88.txt} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{fallback_8ab931cdbc2812bdc302.js => fallback_4972219bd28762fbfd18.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{folder_dependency_ba99384fb6c83b67f435.js => folder_dependency_3263dc642c8ad1171873.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{folder_sub-dependency2_fe244ae613f6967e2f8b.js => folder_sub-dependency2_f750536150de4f4db445.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{folder_sub-dependency_f335316192eeeb416b57.js => folder_sub-dependency_a662b3b186898f776088.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{index_cache_071c12a46730e2dedd60.css => index_cache_502725659b59ae63a82a.css} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{index_query_004fef5280e02f70d9a7.css => index_query_169a64b251bcdc02a084.css} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{redirect_06486fd663ea9c13ee91.js => redirect_d3dcf71bcf15dc29654c.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{resolve_e754563143efbab1c458.js => resolve_69c3f44e55195d0c14cf.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/{url_8a6f05a316d16626dc87.js => url_cc93d527a81c32b07ab8.js} (100%) rename test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/https_raw.githubusercontent.com/{webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md => webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md} (100%) rename test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/{fallback_8ab931cdbc2812bdc302.js => fallback_4972219bd28762fbfd18.js} (100%) rename test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/{index_f3181eddde77a03ff311.css => index_query_169a64b251bcdc02a084.css} (100%) rename test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/{redirect_06486fd663ea9c13ee91.js => redirect_d3dcf71bcf15dc29654c.js} (100%) rename test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/{resolve_e754563143efbab1c458.js => resolve_69c3f44e55195d0c14cf.js} (100%) rename test/configCases/asset-modules/http-url/errors.webpack.lock.data/https_raw.githubusercontent.com/{webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md => webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{asset_46e6c8f1b2a5b24fb643.txt => asset_72216076a225ea0abbaa.txt} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{asset_query_36fd3967a266e1b0a996.txt => asset_query_590ffbc5acc20bf1dc88.txt} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{fallback_8ab931cdbc2812bdc302.js => fallback_4972219bd28762fbfd18.js} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{folder_dependency_ba99384fb6c83b67f435.js => folder_dependency_3263dc642c8ad1171873.js} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{folder_sub-dependency2_fe244ae613f6967e2f8b.js => folder_sub-dependency2_f750536150de4f4db445.js} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{folder_sub-dependency_f335316192eeeb416b57.js => folder_sub-dependency_a662b3b186898f776088.js} (100%) rename test/configCases/asset-modules/http-url/{errors.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css => frozen-verify.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{index_cache_071c12a46730e2dedd60.css => index_query_169a64b251bcdc02a084.css} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{redirect_06486fd663ea9c13ee91.js => redirect_d3dcf71bcf15dc29654c.js} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{resolve_e754563143efbab1c458.js => resolve_69c3f44e55195d0c14cf.js} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/{url_8a6f05a316d16626dc87.js => url_cc93d527a81c32b07ab8.js} (100%) rename test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/https_raw.githubusercontent.com/{webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md => webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{asset_46e6c8f1b2a5b24fb643.txt => asset_72216076a225ea0abbaa.txt} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{asset_query_36fd3967a266e1b0a996.txt => asset_query_590ffbc5acc20bf1dc88.txt} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{fallback_8ab931cdbc2812bdc302.js => fallback_4972219bd28762fbfd18.js} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{folder_dependency_ba99384fb6c83b67f435.js => folder_dependency_3263dc642c8ad1171873.js} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{folder_sub-dependency2_fe244ae613f6967e2f8b.js => folder_sub-dependency2_f750536150de4f4db445.js} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{folder_sub-dependency_f335316192eeeb416b57.js => folder_sub-dependency_a662b3b186898f776088.js} (100%) rename test/configCases/asset-modules/http-url/{frozen-verify.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css => prod-defaults.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css} (100%) delete mode 100644 test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{index_cache_071c12a46730e2dedd60.css => index_query_169a64b251bcdc02a084.css} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{redirect_06486fd663ea9c13ee91.js => redirect_d3dcf71bcf15dc29654c.js} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{resolve_e754563143efbab1c458.js => resolve_69c3f44e55195d0c14cf.js} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/{url_8a6f05a316d16626dc87.js => url_cc93d527a81c32b07ab8.js} (100%) rename test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/https_raw.githubusercontent.com/{webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md => webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md} (100%) diff --git a/declarations/plugins/HashedModuleIdsPlugin.d.ts b/declarations/plugins/HashedModuleIdsPlugin.d.ts index 931c0bd6036..faea6fb5031 100644 --- a/declarations/plugins/HashedModuleIdsPlugin.d.ts +++ b/declarations/plugins/HashedModuleIdsPlugin.d.ts @@ -4,6 +4,11 @@ * Run `yarn special-lint-fix` to update */ +/** + * Algorithm used for generation the hash (see node.js crypto package). + */ +export type HashFunction = string | typeof import("../../lib/util/Hash"); + export interface HashedModuleIdsPluginOptions { /** * The context directory for creating names. @@ -20,5 +25,5 @@ export interface HashedModuleIdsPluginOptions { /** * The hashing algorithm to use, defaults to 'md4'. All functions from Node.JS' crypto.createHash are supported. */ - hashFunction?: string; + hashFunction?: HashFunction; } diff --git a/examples/build-http/README.md b/examples/build-http/README.md index 9eed549a2a4..8c46cd3b81f 100644 --- a/examples/build-http/README.md +++ b/examples/build-http/README.md @@ -30,28 +30,14 @@ module.exports = { ## Unoptimized ``` -asset output.js 61.9 KiB [emitted] (name: main) +asset output.js 82.6 KiB [emitted] (name: main) runtime modules 670 bytes 3 modules -modules by path https:// 21.9 KiB - modules by path https://jspm.dev/ 8.43 KiB +modules by path https:// 30 KiB + modules by path https://jspm.dev/ 16.1 KiB modules by path https://jspm.dev/*.0 6.04 KiB 5 modules - modules by path https://jspm.dev/npm:@jspm/ 1.99 KiB - https://jspm.dev/npm:@jspm/core@2/nodelibs/os 126 bytes [built] [code generated] - [exports: EOL, arch, cpus, default, endianness, freemem, getNetworkInterfaces, homedir, hostname, loadavg, networkInterfaces, platform, release, tmpDir, tmpdir, totalmem, type, uptime] - [used exports unknown] - harmony side effect evaluation /npm:@jspm/core@2/nodelibs/os https://jspm.dev/npm:clean-stack@4 1:0-39 - harmony side effect evaluation ./npm:@jspm/core@2/nodelibs/os https://jspm.dev/npm:clean-stack@4.1.0 1:0-48 - harmony import specifier ./npm:@jspm/core@2/nodelibs/os https://jspm.dev/npm:clean-stack@4.1.0 6:23-33 - harmony import specifier ./npm:@jspm/core@2/nodelibs/os https://jspm.dev/npm:clean-stack@4.1.0 6:57-67 - https://jspm.dev/npm:@jspm/core@2.0.0-beta.8/nodelibs/os 1.87 KiB [built] [code generated] - [exports: EOL, arch, cpus, default, endianness, freemem, getNetworkInterfaces, homedir, hostname, loadavg, networkInterfaces, platform, release, tmpDir, tmpdir, totalmem, type, uptime] - [used exports unknown] - harmony side effect evaluation /npm:@jspm/core@2.0.0-beta.8/nodelibs/os https://jspm.dev/npm:@jspm/core@2/nodelibs/os 1:0-57 - harmony export imported specifier /npm:@jspm/core@2.0.0-beta.8/nodelibs/os https://jspm.dev/npm:@jspm/core@2/nodelibs/os 1:0-57 - harmony side effect evaluation /npm:@jspm/core@2.0.0-beta.8/nodelibs/os https://jspm.dev/npm:@jspm/core@2/nodelibs/os 2:0-67 - harmony export imported specifier /npm:@jspm/core@2.0.0-beta.8/nodelibs/os https://jspm.dev/npm:@jspm/core@2/nodelibs/os 2:0-67 + modules by path https://jspm.dev/npm:@jspm/ 9.67 KiB 3 modules 4 modules - modules by path https://cdn.esm.sh/ 5.72 KiB 7 modules + modules by path https://cdn.esm.sh/ 6.15 KiB 7 modules modules by path https://cdn.skypack.dev/ 7.46 KiB 6 modules https://unpkg.com/p-map-series?module 263 bytes [built] [code generated] [exports: default] @@ -62,17 +48,17 @@ modules by path https:// 21.9 KiB [no exports] [used exports unknown] entry ./example.js main -webpack 5.51.1 compiled successfully +webpack 5.53.0 compiled successfully ``` ## Production mode ``` -asset output.js 11.4 KiB [emitted] [minimized] (name: main) -orphan modules 21.9 KiB [orphan] 25 modules -./example.js + 24 modules 22.1 KiB [built] [code generated] +asset output.js 12.5 KiB [emitted] [minimized] (name: main) +orphan modules 30 KiB [orphan] 26 modules +./example.js + 25 modules 30.2 KiB [built] [code generated] [no exports] [no exports used] entry ./example.js main -webpack 5.51.1 compiled successfully +webpack 5.53.0 compiled successfully ``` diff --git a/examples/build-http/webpack.lock b/examples/build-http/webpack.lock index f0b1d62335c..f696523fd3e 100644 --- a/examples/build-http/webpack.lock +++ b/examples/build-http/webpack.lock @@ -1,19 +1,20 @@ { - "https://cdn.esm.sh/p-map": { "integrity": "sha512-Q1RsGrT9Fl5eqmmFQbaCy4PcXRx90TZQCcHDWC6sN0vfEnco9o66mi1DNjaWD2HE40qn0cNTWoZ21RIH+jmeiQ==", "contentType": "application/javascript; charset=utf-8" }, - "https://cdn.esm.sh/v43/aggregate-error@4.0.0/es2015/aggregate-error.js": { "integrity": "sha512-nnqEIbQNpkAb5idk+07Wbc8lNzPloQrPAs+SOjccU+va8qftYFcn0htGVwUqwvkWJHZaJn9/B5bXB2YZVzwvUg==", "contentType": "application/javascript" }, - "https://cdn.esm.sh/v43/clean-stack@4.1.0/es2015/clean-stack.js": { "integrity": "sha512-B6h1ZeTzVvZeNUbWJUvEIBPaTvyUnbNEaO+V0aREh7nR1OrFUON/xnG+jwJwEzLWACqQNKFeFiPBOlFowUZ5FQ==", "contentType": "application/javascript" }, - "https://cdn.esm.sh/v43/escape-string-regexp@5.0.0/es2015/escape-string-regexp.js": { "integrity": "sha512-e6uaGCpjIjNgUN5K6nm+BQ3HrIKj59Z/ySJDt86eOM1j7ri1PFvpRFq7JwyjGZ0mhNq/j4ywqNmmk7HEji1Chg==", "contentType": "application/javascript" }, - "https://cdn.esm.sh/v43/indent-string@5.0.0/es2015/indent-string.js": { "integrity": "sha512-yNbq6+IcXe6jW+HIM/dCPxvi1+NJRxo5msNe0Vdg4NqVVUV4DF8U2eJPehmKT0Xhv1viyaTiReidhB1BmE1f/A==", "contentType": "application/javascript" }, - "https://cdn.esm.sh/v43/os-browserify@0.3.0/es2015/browser.js": { "integrity": "sha512-/BeiBawWpXZlWTjmXwtmrZbBeYgD0BqB9LE3EDf4yxBYqASwZ7Xj2dYNruM3/WMbJYyjP/TSRdwuKMsNLWdZbw==", "contentType": "application/javascript" }, - "https://cdn.esm.sh/v43/p-map@5.1.0/es2015/p-map.js": { "integrity": "sha512-DLSkffQJHasMXlosBDDFEIn7zgcLUW5KrTHy5/3IFsrmQO+9zlYjlWQbDJEShfvDzFEhXJc9D4ppP6zykBK/ZA==", "contentType": "application/javascript" }, + "https://cdn.esm.sh/p-map": { "integrity": "sha512-TfztRxlC5elIRa7x3oz4bfhtxJr5hIhoa+bliQkroNj8haEMPp1mv/eAsfzBt032G1oK6JT6y3135FP0vRh13Q==", "contentType": "application/javascript; charset=utf-8" }, + "https://cdn.esm.sh/v53/aggregate-error@4.0.0/es2015/aggregate-error.js": { "integrity": "sha512-4iHvwySJO0Dn0aenl2XY1XCGEoMZFaJ+PkuO8Op0BRVNwHiZaKrCuMnPZqUblPhvAG2o8SEA4JdB/fhS3IQZLg==", "contentType": "application/javascript" }, + "https://cdn.esm.sh/v53/clean-stack@4.1.0/es2015/clean-stack.js": { "integrity": "sha512-VzcwF50IxKsmW4O2DpY8WB6TmYh9caBctTqA2EkE3p9K8JjITMD/qBNqfVmUKAlmq4CFgI3c0xegzMf1BRWbyQ==", "contentType": "application/javascript" }, + "https://cdn.esm.sh/v53/escape-string-regexp@5.0.0/es2015/escape-string-regexp.js": { "integrity": "sha512-vst7rz+jFlvZMjo5GUzNBSq7QvFoaqOQ+hDq0m40ZJYGts6ptt+QKLZOMDWgoEq3Fabnhiy+hsoIfaHMmVdbSQ==", "contentType": "application/javascript" }, + "https://cdn.esm.sh/v53/indent-string@5.0.0/es2015/indent-string.js": { "integrity": "sha512-o1hDF1EyRTCiDpcxD2i0XpIuHCMFrc9XkKrkMISIaiWpJdKU7HBRhtqXfBcpVfJF1uNAFJ7/1v40vpPH2r7X8w==", "contentType": "application/javascript" }, + "https://cdn.esm.sh/v53/os-browserify@0.3.0/es2015/browser.js": { "integrity": "sha512-8JOZWkDGX6WNFtXIk/aOawVo35LZSIgCdbMrleK4QL8kHcYti2oTjfqfn99AJm6SOUsTt0uY5K808uHAvVe3eA==", "contentType": "application/javascript" }, + "https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js": { "integrity": "sha512-3kEIICBOLKnEn6SNNixOBy+VGgwh0DYtn07yxHfagwiSJV8om7q/37RdHVbQ2pol8B/6oVMHo7Y6YYhmpYKDUA==", "contentType": "application/javascript" }, "https://cdn.skypack.dev/-/aggregate-error@v4.0.0-rCH8s5R9g4kQQ807o58j/dist=es2020,mode=imports/optimized/aggregate-error.js": { "integrity": "sha512-E5rN3mgPTqyfHSovQ++ZyZWQkMUniuyjbeHHX+E4G3MStEx6TfObScB8tfHeIyuawSp86nVsFfMZjCruD61rdg==", "contentType": "application/javascript; charset=utf-8" }, "https://cdn.skypack.dev/-/clean-stack@v4.1.0-DgWUKXHVzThBBZtsHXhC/dist=es2020,mode=imports/optimized/clean-stack.js": { "integrity": "sha512-1nEMT4Vc2YLu3EbeBnck7Traj0/D6G9MMSGraGpsoQIMKVuhQjq4gP76X6RxUn5GoiHv90KfrFMSWlbBn26Dhw==", "contentType": "application/javascript; charset=utf-8" }, "https://cdn.skypack.dev/-/escape-string-regexp@v5.0.0-SUDdAhYOdAgXIYndxZss/dist=es2020,mode=imports/optimized/escape-string-regexp.js": { "integrity": "sha512-54oHYow5obgsKb0twQZMNLvCH2tV5MCOY4YHB0LQH+zVonIAn7JYZseUPWhC3MMkJFK5EkeNWDAX7P2camp27g==", "contentType": "application/javascript; charset=utf-8" }, "https://cdn.skypack.dev/-/indent-string@v5.0.0-VgKPSgi4hUX5NbF4n3aC/dist=es2020,mode=imports/optimized/indent-string.js": { "integrity": "sha512-lSZAs06jEHkVlPMEeMtKbygGhrSmJUMVmpB6/2ChdG2F0694vRU1v6N12bUyqR5uGbbteTJ7atP5PmPtTVmlcw==", "contentType": "application/javascript; charset=utf-8" }, "https://cdn.skypack.dev/-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js": { "integrity": "sha512-mZyhNJe8VlqEqafSkUGTooFrKcQPSwVjB3UxAAPqywSFD+age77uTRP6ul8uAMEQ3lllmengXX1q45igRxRcDw==", "contentType": "application/javascript; charset=utf-8" }, "https://cdn.skypack.dev/p-map": { "integrity": "sha512-FFu6R9j8mrGqTvw8WL37XsWhI9P65XdPD9Jfs/47jiYNdex12f0XJNsIy+fI81PbOkCuEQRgm2nf0P76ieBlag==", "contentType": "application/javascript; charset=utf-8" }, - "https://jspm.dev/npm:@jspm/core@2.0.0-beta.8/nodelibs/os": { "integrity": "sha512-bNMLa9/IfXCZprEMIuXuHM/9s4OFAl4ZKy8r6EdXNkduLNLHQ626srFqLRdWHx6ZWGIgppc1bI9+tRJT3FzfAw==", "contentType": "application/javascript; charset=utf-8" }, - "https://jspm.dev/npm:@jspm/core@2/nodelibs/os": { "integrity": "sha512-rPwqsk0nq0tqTCdbeGoopnlzAVh5BsaVUsXoFKQCcb04LWJrXmOhQEwj1Yj/WHfNj2ZIPzODlZdKtWZl5bbIpA==", "contentType": "application/javascript; charset=utf-8" }, + "https://jspm.dev/npm:@jspm/core@2.0.0-beta.11/nodelibs/os": { "integrity": "sha512-Jsg9UMzfNTnlPDu6FeftYzdp6XULJwLDI7xFSzULhMqjQUoOIHJhkAToEgr3NnEKCkLZQMIPuBvHAn0ud6gT+w==", "contentType": "application/javascript; charset=utf-8" }, + "https://jspm.dev/npm:@jspm/core@2.0.0-beta.11/nodelibs/process": { "integrity": "sha512-KIYEmkrnT7TL5EKA5coPbbdoqfL2twHFBVXKTZS+PU5aZFX90yELxZHrm4DhxSQ33FLAWo51/nQLQmqGekWNMw==", "contentType": "application/javascript; charset=utf-8" }, + "https://jspm.dev/npm:@jspm/core@2/nodelibs/os": { "integrity": "sha512-g2ppEW1AVdbIpc486D0ZmLIR5CtzMITkBwqoBgxvhiIq5/qHP4/unZ7Czk3q8A1UwdTI4wbGzRWndXAUa4/Q0Q==", "contentType": "application/javascript; charset=utf-8" }, "https://jspm.dev/npm:aggregate-error@4": { "integrity": "sha512-XfXd6EZ09/SKLmWFFvjPCSkqv0E08IxKc8mFm9mePyLIiEiGyAKokeFt1wql+kG8ikGmI7YqKBsDf07/I31VvA==", "contentType": "application/javascript; charset=utf-8" }, "https://jspm.dev/npm:aggregate-error@4.0.0": { "integrity": "sha512-HEobsVYXVCp5H4Z+6qAlKno8XAJwHQrfF4ivR4PHrp4ttM0Yg0zDfOcsjqJOnTP5hEnKR1K6OzQdPfR2r9of4g==", "contentType": "application/javascript; charset=utf-8" }, "https://jspm.dev/npm:clean-stack@4": { "integrity": "sha512-3wh/QTJY4tw/GInIcn5I+0hsHSirJi8Tf3kmH85hzQsuwB5k2lghBFZyKZPO7/Ql3muvZeDgN02pYkZap59Qrw==", "contentType": "application/javascript; charset=utf-8" }, diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9a051b191b6af4b352ba b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9a051b191b6af4b352ba deleted file mode 100644 index 09db000630f..00000000000 --- a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9a051b191b6af4b352ba +++ /dev/null @@ -1,3 +0,0 @@ -/* esm.sh - p-map@5.1.0 */ -export * from "https://cdn.esm.sh/v43/p-map@5.1.0/es2015/p-map.js"; -export { default } from "https://cdn.esm.sh/v43/p-map@5.1.0/es2015/p-map.js"; diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9dd32c023fd5f3d3e7f2 b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9dd32c023fd5f3d3e7f2 new file mode 100644 index 00000000000..5034fb3895a --- /dev/null +++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9dd32c023fd5f3d3e7f2 @@ -0,0 +1,3 @@ +/* esm.sh - p-map@5.1.0 */ +export * from "https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js"; +export { default } from "https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js"; diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_aggregate-error_4.0.0_es2015_aggregate-error_89888e7f244a2b227be9.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_aggregate-error_4.0.0_es2015_aggregate-error_89888e7f244a2b227be9.js deleted file mode 100644 index 0fa8ce04381..00000000000 --- a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_aggregate-error_4.0.0_es2015_aggregate-error_89888e7f244a2b227be9.js +++ /dev/null @@ -1,3 +0,0 @@ -var f=Object.defineProperty;var l=(e,t,n)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var i=(e,t,n)=>(l(e,typeof t!="symbol"?t+"":t,n),n),g=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var c=(e,t,n)=>(g(e,t,"read from private field"),n?n.call(e):t.get(e)),o=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},p=(e,t,n,a)=>(g(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n);import u from"/v43/indent-string@5.0.0/es2015/indent-string.js";import m from"/v43/clean-stack@4.1.0/es2015/clean-stack.js";var d=e=>e.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""),r,s=class extends Error{constructor(t){o(this,r,void 0);i(this,"name","AggregateError");if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);t=t.map(a=>a instanceof Error?a:a!==null&&typeof a=="object"?Object.assign(new Error(a.message),a):new Error(a));let n=t.map(a=>typeof a.stack=="string"?d(m(a.stack)):String(a)).join(` -`);n=` -`+u(n,4),super(n),p(this,r,t)}get errors(){return c(this,r).slice()}};r=new WeakMap;export{s as default}; \ No newline at end of file diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_clean-stack_4.1.0_es2015_clean-stack_512fad7a42bd85149e06.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_clean-stack_4.1.0_es2015_clean-stack_512fad7a42bd85149e06.js deleted file mode 100644 index d2024661d22..00000000000 --- a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_clean-stack_4.1.0_es2015_clean-stack_512fad7a42bd85149e06.js +++ /dev/null @@ -1,3 +0,0 @@ -import s from"/v43/os-browserify@0.3.0/es2015/browser.js";import i from"/v43/escape-string-regexp@5.0.0/es2015/escape-string-regexp.js";var p=/\s+at.*[(\s](.*)\)?/,f=/^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/,u=typeof s.homedir=="undefined"?"":s.homedir().replace(/\\/g,"/");function c(a,{pretty:l=!1,basePath:n}={}){let o=n&&new RegExp(`(at | \\()${i(n.replace(/\\/g,"/"))}`,"g");if(typeof a=="string")return a.replace(/\\/g,"/").split(` -`).filter(e=>{let r=e.match(p);if(r===null||!r[1])return!0;let t=r[1];return t.includes(".app/Contents/Resources/electron.asar")||t.includes(".app/Contents/Resources/default_app.asar")?!1:!f.test(t)}).filter(e=>e.trim()!=="").map(e=>(o&&(e=e.replace(o,"$1")),l&&(e=e.replace(p,(r,t)=>r.replace(t,t.replace(u,"~")))),e)).join(` -`)}export{c as default}; \ No newline at end of file diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_p-map_5.1.0_es2015_p-map_2e9e4310942f189ff123.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_p-map_5.1.0_es2015_p-map_2e9e4310942f189ff123.js deleted file mode 100644 index 0202cd3f60c..00000000000 --- a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_p-map_5.1.0_es2015_p-map_2e9e4310942f189ff123.js +++ /dev/null @@ -1 +0,0 @@ -var m=(p,s,e)=>new Promise((f,x)=>{var h=t=>{try{o(e.next(t))}catch(r){x(r)}},l=t=>{try{o(e.throw(t))}catch(r){x(r)}},o=t=>t.done?f(t.value):Promise.resolve(t.value).then(h,l);o((e=e.apply(p,s)).next())});import S from"/v43/aggregate-error@4.0.0/es2015/aggregate-error.js";function N(x,h){return m(this,arguments,function*(p,s,{concurrency:e=Number.POSITIVE_INFINITY,stopOnError:f=!0}={}){return new Promise((l,o)=>{if(typeof s!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(e)||e===Number.POSITIVE_INFINITY)&&e>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${e}\` (${typeof e})`);let t=[],r=[],g=[],y=p[Symbol.iterator](),u=!1,c=!1,a=0,b=0,I=()=>{if(u)return;let i=y.next(),d=b;if(b++,i.done){if(c=!0,a===0)if(!f&&r.length>0)o(new S(r));else{for(let n of g)t.splice(n,1);l(t)}return}a++,(()=>m(this,null,function*(){try{let n=yield i.value;if(u)return;let w=yield s(n,d);w===T?g.push(d):t[d]=w,a--,I()}catch(n){f?(u=!0,o(n)):(r.push(n),a--,I())}}))()};for(let i=0;it in n?l(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var s=(n,t,e)=>(f(n,typeof t!="symbol"?t+"":t,e),e),i=(n,t,e)=>{if(!t.has(n))throw TypeError("Cannot "+e)};var c=(n,t,e)=>(i(n,t,"read from private field"),e?e.call(n):t.get(n)),g=(n,t,e)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,e)},o=(n,t,e,a)=>(i(n,t,"write to private field"),a?a.call(n,e):t.set(n,e),e);import u from"/v53/indent-string@5.0.0/es2015/indent-string.js";import m from"/v53/clean-stack@4.1.0/es2015/clean-stack.js";var d=n=>n.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""),r,p=class extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);t=t.map(a=>a instanceof Error?a:a!==null&&typeof a=="object"?Object.assign(new Error(a.message),a):new Error(a));let e=t.map(a=>typeof a.stack=="string"?d(m(a.stack)):String(a)).join(` +`);e=` +`+u(e,4);super(e);g(this,r,void 0);s(this,"name","AggregateError");o(this,r,t)}get errors(){return c(this,r).slice()}};r=new WeakMap;export{p as default}; diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_clean-stack_4.1.0_es2015_clean-stack_87b32b37ae264a8e8a1c.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_clean-stack_4.1.0_es2015_clean-stack_87b32b37ae264a8e8a1c.js new file mode 100644 index 00000000000..a3c644a1fb2 --- /dev/null +++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_clean-stack_4.1.0_es2015_clean-stack_87b32b37ae264a8e8a1c.js @@ -0,0 +1,4 @@ +/* esm.sh - esbuild bundle(clean-stack@4.1.0) es2015 production */ +import s from"/v53/os-browserify@0.3.0/es2015/browser.js";import i from"/v53/escape-string-regexp@5.0.0/es2015/escape-string-regexp.js";var p=/\s+at.*[(\s](.*)\)?/,l=/^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/,f=typeof s.homedir=="undefined"?"":s.homedir().replace(/\\/g,"/");function u(n,{pretty:c=!1,basePath:a}={}){let o=a&&new RegExp(`(at | \\()${i(a.replace(/\\/g,"/"))}`,"g");if(typeof n=="string")return n.replace(/\\/g,"/").split(` +`).filter(e=>{let r=e.match(p);if(r===null||!r[1])return!0;let t=r[1];return t.includes(".app/Contents/Resources/electron.asar")||t.includes(".app/Contents/Resources/default_app.asar")?!1:!l.test(t)}).filter(e=>e.trim()!=="").map(e=>(o&&(e=e.replace(o,"$1")),c&&(e=e.replace(p,(r,t)=>r.replace(t,t.replace(f,"~")))),e)).join(` +`)}export{u as default}; diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_escape-string-regexp_5.0.0_es2015_escape-string-regexp_22382d8d9f837184e161.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_escape-string-regexp_5.0.0_es2015_escape-string-regexp_2c814e466860133eca86.js similarity index 52% rename from examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_escape-string-regexp_5.0.0_es2015_escape-string-regexp_22382d8d9f837184e161.js rename to examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_escape-string-regexp_5.0.0_es2015_escape-string-regexp_2c814e466860133eca86.js index 4c87ee6f361..a70aa3b9a9e 100644 --- a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_escape-string-regexp_5.0.0_es2015_escape-string-regexp_22382d8d9f837184e161.js +++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_escape-string-regexp_5.0.0_es2015_escape-string-regexp_2c814e466860133eca86.js @@ -1 +1,2 @@ -function r(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}export{r as default}; \ No newline at end of file +/* esm.sh - esbuild bundle(escape-string-regexp@5.0.0) es2015 production */ +function r(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}export{r as default}; diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_indent-string_5.0.0_es2015_indent-string_6103e1cfb4ff573a03ed.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_indent-string_5.0.0_es2015_indent-string_171b2b5ba89965a085b6.js similarity index 50% rename from examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_indent-string_5.0.0_es2015_indent-string_6103e1cfb4ff573a03ed.js rename to examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_indent-string_5.0.0_es2015_indent-string_171b2b5ba89965a085b6.js index 67abd53aedd..758f021c33e 100644 --- a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_indent-string_5.0.0_es2015_indent-string_6103e1cfb4ff573a03ed.js +++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_indent-string_5.0.0_es2015_indent-string_171b2b5ba89965a085b6.js @@ -1 +1,2 @@ -function o(t,e=1,n={}){let{indent:r=" ",includeEmptyLines:p=!1}=n;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===0)return t;let i=p?/^/gm:/^(?!\s*$)/gm;return t.replace(i,r.repeat(e))}export{o as default}; \ No newline at end of file +/* esm.sh - esbuild bundle(indent-string@5.0.0) es2015 production */ +function i(t,e=1,o={}){let{indent:r=" ",includeEmptyLines:n=!1}=o;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===0)return t;let p=n?/^/gm:/^(?!\s*$)/gm;return t.replace(p,r.repeat(e))}export{i as default}; diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_os-browserify_0.3.0_es2015_browser_92a2351b7a3273e492dd.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_os-browserify_0.3.0_es2015_browser_476a088316baaea08336.js similarity index 66% rename from examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_os-browserify_0.3.0_es2015_browser_92a2351b7a3273e492dd.js rename to examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_os-browserify_0.3.0_es2015_browser_476a088316baaea08336.js index 2d987fbea9c..951e12edff7 100644 --- a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v43_os-browserify_0.3.0_es2015_browser_92a2351b7a3273e492dd.js +++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_os-browserify_0.3.0_es2015_browser_476a088316baaea08336.js @@ -1,2 +1,3 @@ +/* esm.sh - esbuild bundle(os-browserify@0.3.0/browser) es2015 production */ var f=Object.create;var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var d=e=>o(e,"__esModule",{value:!0});var l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var w=(e,t,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!p.call(e,n)&&n!=="default"&&o(e,n,{get:()=>t[n],enumerable:!(i=s(t,n))||i.enumerable});return e},a=e=>w(d(o(e!=null?f(c(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var u=l(r=>{r.endianness=function(){return"LE"};r.hostname=function(){return typeof location!="undefined"?location.hostname:""};r.loadavg=function(){return[]};r.uptime=function(){return 0};r.freemem=function(){return Number.MAX_VALUE};r.totalmem=function(){return Number.MAX_VALUE};r.cpus=function(){return[]};r.type=function(){return"Browser"};r.release=function(){return typeof navigator!="undefined"?navigator.appVersion:""};r.networkInterfaces=r.getNetworkInterfaces=function(){return{}};r.arch=function(){return"javascript"};r.platform=function(){return"browser"};r.tmpdir=r.tmpDir=function(){return"/tmp"};r.EOL=` -`;r.homedir=function(){return"/"}});var b=a(u()),h=a(u()),{cpus:v,release:E,tmpDir:L,loadavg:k,uptime:A,totalmem:I,arch:N,tmpdir:_,homedir:V,endianness:x,hostname:D,type:M,freemem:O,networkInterfaces:U,getNetworkInterfaces:X,platform:j,EOL:B}=b;var export_default=h.default;export{B as EOL,N as arch,v as cpus,export_default as default,x as endianness,O as freemem,X as getNetworkInterfaces,V as homedir,D as hostname,k as loadavg,U as networkInterfaces,j as platform,E as release,L as tmpDir,_ as tmpdir,I as totalmem,M as type,A as uptime}; \ No newline at end of file +`;r.homedir=function(){return"/"}});var b=a(u()),h=a(u()),{endianness:v,hostname:E,loadavg:L,uptime:k,freemem:A,totalmem:I,cpus:N,type:_,release:V,networkInterfaces:x,getNetworkInterfaces:D,arch:M,platform:O,tmpdir:U,tmpDir:X,EOL:j,homedir:B}=b;var export_default=h.default;export{j as EOL,M as arch,N as cpus,export_default as default,v as endianness,A as freemem,D as getNetworkInterfaces,B as homedir,E as hostname,L as loadavg,x as networkInterfaces,O as platform,V as release,X as tmpDir,U as tmpdir,I as totalmem,_ as type,k as uptime}; diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_p-map_5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_p-map_5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js new file mode 100644 index 00000000000..8baf6a8521d --- /dev/null +++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_p-map_5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js @@ -0,0 +1,2 @@ +/* esm.sh - esbuild bundle(p-map@5.1.0) es2015 production */ +var g=(l,s,e)=>new Promise((f,x)=>{var N=t=>{try{n(e.next(t))}catch(r){x(r)}},p=t=>{try{n(e.throw(t))}catch(r){x(r)}},n=t=>t.done?f(t.value):Promise.resolve(t.value).then(N,p);n((e=e.apply(l,s)).next())});import y from"/v53/aggregate-error@4.0.0/es2015/aggregate-error.js";function S(x,N){return g(this,arguments,function*(l,s,{concurrency:e=Number.POSITIVE_INFINITY,stopOnError:f=!0}={}){return new Promise((p,n)=>{if(typeof s!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(e)||e===Number.POSITIVE_INFINITY)&&e>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${e}\` (${typeof e})`);let t=[],r=[],m=[],h=l[Symbol.iterator](),u=!1,c=!1,a=0,b=0,I=()=>{if(u)return;let i=h.next(),d=b;if(b++,i.done){if(c=!0,a===0)if(!f&&r.length>0)n(new y(r));else{for(let o of m)t.splice(o,1);p(t)}return}a++,(()=>g(this,null,function*(){try{let o=yield i.value;if(u)return;let w=yield s(o,d);w===T?m.push(d):t[d]=w,a--,I()}catch(o){f?(u=!0,n(o)):(r.push(o),a--,I())}}))()};for(let i=0;i 1) { + for (var i = 1; i < arguments.length; i++) + args[i - 1] = arguments[i]; + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) + setTimeout(drainQueue, 0); +} +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; + +var title = 'browser'; +var arch = 'x64'; +var platform = 'browser'; +var env = { + PATH: '/usr/bin', + LANG: navigator.language + '.UTF-8', + PWD: '/', + HOME: '/home', + TMP: '/tmp', +}; +var argv = ['/usr/bin/node']; +var execArgv = []; +var version = 'v16.8.0'; +var versions = { node: '16.8.0' }; + +var emitWarning = function(message, type) { + console.warn((type ? (type + ': ') : '') + message); +}; + +var binding = function(name) { unimplemented('binding'); }; + +var umask = function(mask) { return 0; }; + +var cwd = function() { return '/'; }; +var chdir = function(dir) {}; + +var release = { + name: 'node', + sourceUrl: '', + headersUrl: '', + libUrl: '', +}; + +function noop() {} + +var _rawDebug = noop; +var moduleLoadList = []; +function _linkedBinding(name) { unimplemented('_linkedBinding'); } +var domain = {}; +var _exiting = false; +var config = {}; +function dlopen(name) { unimplemented('dlopen'); } +function _getActiveRequests() { return []; } +function _getActiveHandles() { return []; } +var reallyExit = noop; +var _kill = noop; +var cpuUsage = function() { return {}; }; +var resourceUsage = cpuUsage; +var memoryUsage = cpuUsage; +var kill = noop; +var exit = noop; +var openStdin = noop; +var allowedNodeEnvironmentFlags = {}; +function assert(condition, message) { + if (!condition) throw new Error(message || 'assertion error'); +} +var features = { + inspector: false, + debug: false, + uv: false, + ipv6: false, + tls_alpn: false, + tls_sni: false, + tls_ocsp: false, + tls: false, + cached_builtins: true, +}; +var _fatalExceptions = noop; +var setUncaughtExceptionCaptureCallback = noop; +function hasUncaughtExceptionCaptureCallback() { return false; }var _tickCallback = noop; +var _debugProcess = noop; +var _debugEnd = noop; +var _startProfilerIdleNotifier = noop; +var _stopProfilerIdleNotifier = noop; +var stdout = undefined; +var stderr = undefined; +var stdin = undefined; +var abort = noop; +var pid = 2; +var ppid = 1; +var execPath = '/bin/usr/node'; +var debugPort = 9229; +var argv0 = 'node'; +var _preload_modules = []; +var setSourceMapsEnabled = noop; + +var _performance = { + now: typeof performance !== 'undefined' ? performance.now.bind(performance) : undefined, + timing: typeof performance !== 'undefined' ? performance.timing : undefined, +}; +if (_performance.now === undefined) { + var nowOffset = Date.now(); + + if (_performance.timing && _performance.timing.navigationStart) { + nowOffset = _performance.timing.navigationStart; + } + _performance.now = () => Date.now() - nowOffset; +} + +function uptime() { + return _performance.now() / 1000; +} + +var nanoPerSec = 1000000000; +function hrtime(previousTimestamp) { + var baseNow = Math.floor((Date.now() - _performance.now()) * 1e-3); + var clocktime = _performance.now() * 1e-3; + var seconds = Math.floor(clocktime) + baseNow; + var nanoseconds = Math.floor((clocktime % 1) * 1e9); + if (previousTimestamp) { + seconds = seconds - previousTimestamp[0]; + nanoseconds = nanoseconds - previousTimestamp[1]; + if (nanoseconds < 0) { + seconds--; + nanoseconds += nanoPerSec; + } + } + return [seconds, nanoseconds]; +}hrtime.bigint = function(time) { + var diff = hrtime(time); + if (typeof BigInt === 'undefined') { + return diff[0] * nanoPerSec + diff[1]; + } + return BigInt(diff[0] * nanoPerSec) + BigInt(diff[1]); +}; + +var _maxListeners = 10; +var _events = {}; +var _eventsCount = 0; +function on () { return process }var addListener = on; +var once = on; +var off = on; +var removeListener = on; +var removeAllListeners = on; +var emit = noop; +var prependListener = on; +var prependOnceListener = on; +function listeners (name) { return []; } +var process = { + version, + versions, + arch, + platform, + release, + _rawDebug, + moduleLoadList, + binding, + _linkedBinding, + _events, + _eventsCount, + _maxListeners, + on, + addListener, + once, + off, + removeListener, + removeAllListeners, + emit, + prependListener, + prependOnceListener, + listeners, + domain, + _exiting, + config, + dlopen, + uptime, + _getActiveRequests, + _getActiveHandles, + reallyExit, + _kill, + cpuUsage, + resourceUsage, + memoryUsage, + kill, + exit, + openStdin, + allowedNodeEnvironmentFlags, + assert, + features, + _fatalExceptions, + setUncaughtExceptionCaptureCallback, + hasUncaughtExceptionCaptureCallback, + emitWarning, + nextTick, + _tickCallback, + _debugProcess, + _debugEnd, + _startProfilerIdleNotifier, + _stopProfilerIdleNotifier, + stdout, + stdin, + stderr, + abort, + umask, + chdir, + cwd, + env, + title, + argv, + execArgv, + pid, + ppid, + execPath, + debugPort, + hrtime, + argv0, + _preload_modules, + setSourceMapsEnabled, +}; + +export { _debugEnd, _debugProcess, _events, _eventsCount, _exiting, _fatalExceptions, _getActiveHandles, _getActiveRequests, _kill, _linkedBinding, _maxListeners, _preload_modules, _rawDebug, _startProfilerIdleNotifier, _stopProfilerIdleNotifier, _tickCallback, abort, addListener, allowedNodeEnvironmentFlags, arch, argv, argv0, assert, binding, chdir, config, cpuUsage, cwd, debugPort, process as default, dlopen, domain, emit, emitWarning, env, execArgv, execPath, exit, features, hasUncaughtExceptionCaptureCallback, hrtime, kill, listeners, memoryUsage, moduleLoadList, nextTick, off, on, once, openStdin, pid, platform, ppid, prependListener, prependOnceListener, reallyExit, release, removeAllListeners, removeListener, resourceUsage, setSourceMapsEnabled, setUncaughtExceptionCaptureCallback, stderr, stdin, stdout, title, umask, uptime, version, versions }; + +//# sourceMappingURL=process.map \ No newline at end of file diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_2b28d9456b8c8ef4d6fb.8_nodelibs_os b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_1620e8f9e144fe702a06.11_nodelibs_os similarity index 65% rename from examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_2b28d9456b8c8ef4d6fb.8_nodelibs_os rename to examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_1620e8f9e144fe702a06.11_nodelibs_os index a1ed1ea46ac..65ca57a8711 100644 --- a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_2b28d9456b8c8ef4d6fb.8_nodelibs_os +++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_1620e8f9e144fe702a06.11_nodelibs_os @@ -1,3 +1,6 @@ +import { uptime } from './process'; +export { uptime } from './process'; + var exports = {}, _dewExec = false; function dew() { @@ -73,25 +76,38 @@ function dew() { var os = dew(); -var EOL = os.EOL; -var arch = os.arch; -var cpus = os.cpus; -var endianness = os.endianness; -var freemem = os.freemem; -var getNetworkInterfaces = os.getNetworkInterfaces; -var homedir = os.homedir; -var hostname = os.hostname; -var loadavg = os.loadavg; -var networkInterfaces = os.networkInterfaces; -var platform = os.platform; -var release = os.release; -var tmpDir = os.tmpDir; -var tmpdir = os.tmpdir; -var totalmem = os.totalmem; +var _endianness = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1 ? 'LE' : 'BE'; +os.endianness = function() { return _endianness; }; +os.homedir = function() { return '/home'; }; +os.version = function() { return ''; }; +os.arch = function() { return 'x64'; }; +os.totalmem = function() { + return navigator.deviceMemory !== undefined ? navigator.deviceMemory * (1 << 30) : 2 * (1 << 30); +}; +os.cpus = function () { + return Array(navigator.hardwareConcurrency || 0).fill({ model: '', times: {} }); +}; +os.uptime = uptime; +os.constants = {}; +var version = os.version; +var constants = os.constants; +var EOL = os.EOL; +var arch = os.arch; +var cpus = os.cpus; +var endianness = os.endianness; +var freemem = os.freemem; +var getNetworkInterfaces = os.getNetworkInterfaces; +var homedir = os.homedir; +var hostname = os.hostname; +var loadavg = os.loadavg; +var networkInterfaces = os.networkInterfaces; +var platform = os.platform; +var release = os.release; +var tmpDir = os.tmpDir; +var tmpdir = os.tmpdir; +var totalmem = os.totalmem; var type = os.type; -var uptime = os.uptime; -export default os; -export { EOL, arch, cpus, endianness, freemem, getNetworkInterfaces, homedir, hostname, loadavg, networkInterfaces, platform, release, tmpDir, tmpdir, totalmem, type, uptime }; +export { EOL, arch, constants, cpus, os as default, endianness, freemem, getNetworkInterfaces, homedir, hostname, loadavg, networkInterfaces, platform, release, tmpDir, tmpdir, totalmem, type, version }; //# sourceMappingURL=os.map \ No newline at end of file diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_3fe9447e10c5fed754bb b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_3fe9447e10c5fed754bb new file mode 100644 index 00000000000..4accb6487ef --- /dev/null +++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_3fe9447e10c5fed754bb @@ -0,0 +1,3 @@ +import "/npm:@jspm/core@2.0.0-beta.11/nodelibs/process"; +export * from "/npm:@jspm/core@2.0.0-beta.11/nodelibs/os"; +export { default } from "/npm:@jspm/core@2.0.0-beta.11/nodelibs/os"; diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_cf88df9df31061bcb921 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_cf88df9df31061bcb921 deleted file mode 100644 index 69dc15e2fba..00000000000 --- a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_cf88df9df31061bcb921 +++ /dev/null @@ -1,2 +0,0 @@ -export * from "/npm:@jspm/core@2.0.0-beta.8/nodelibs/os"; -export { default } from "/npm:@jspm/core@2.0.0-beta.8/nodelibs/os"; diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_p-map_5.1_bd0dfdcf7f62202ed19e.0 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_p-map_5.1_9895e1a83d37d06ab277.0 similarity index 100% rename from examples/build-http/webpack.lock.data/https_jspm.dev/npm_p-map_5.1_bd0dfdcf7f62202ed19e.0 rename to examples/build-http/webpack.lock.data/https_jspm.dev/npm_p-map_5.1_9895e1a83d37d06ab277.0 diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/p-map_6fa685460a5a6deb568e b/examples/build-http/webpack.lock.data/https_jspm.dev/p-map_875efed0b6bd20646dd2 similarity index 100% rename from examples/build-http/webpack.lock.data/https_jspm.dev/p-map_6fa685460a5a6deb568e rename to examples/build-http/webpack.lock.data/https_jspm.dev/p-map_875efed0b6bd20646dd2 diff --git a/examples/build-http/webpack.lock.data/https_unpkg.com/p-map-series_3.0.0_index_module_9660a252c7a76b957d99.js b/examples/build-http/webpack.lock.data/https_unpkg.com/p-map-series_3.0.0_index_module_cb329557880410b778cf.js similarity index 100% rename from examples/build-http/webpack.lock.data/https_unpkg.com/p-map-series_3.0.0_index_module_9660a252c7a76b957d99.js rename to examples/build-http/webpack.lock.data/https_unpkg.com/p-map-series_3.0.0_index_module_cb329557880410b778cf.js diff --git a/lib/CacheFacade.js b/lib/CacheFacade.js index 464eeef6262..acd22c7405e 100644 --- a/lib/CacheFacade.js +++ b/lib/CacheFacade.js @@ -13,6 +13,7 @@ const mergeEtags = require("./cache/mergeEtags"); /** @typedef {import("./Cache").Etag} Etag */ /** @typedef {import("./WebpackError")} WebpackError */ /** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */ +/** @typedef {typeof import("./util/Hash")} HashConstructor */ /** * @template T @@ -198,10 +199,12 @@ class CacheFacade { /** * @param {Cache} cache the root cache * @param {string} name the child cache name + * @param {string | HashConstructor} hashFunction the hash function to use */ - constructor(cache, name) { + constructor(cache, name, hashFunction) { this._cache = cache; this._name = name; + this._hashFunction = hashFunction; } /** @@ -209,7 +212,11 @@ class CacheFacade { * @returns {CacheFacade} child cache */ getChildCache(name) { - return new CacheFacade(this._cache, `${this._name}|${name}`); + return new CacheFacade( + this._cache, + `${this._name}|${name}`, + this._hashFunction + ); } /** @@ -230,7 +237,7 @@ class CacheFacade { * @returns {Etag} an etag that is lazy hashed */ getLazyHashedEtag(obj) { - return getLazyHashedEtag(obj); + return getLazyHashedEtag(obj, this._hashFunction); } /** diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index b428308fce6..24e0a817925 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -34,6 +34,7 @@ const { /** @typedef {import("./Module")} Module */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ /** @typedef {import("./RuntimeModule")} RuntimeModule */ +/** @typedef {typeof import("./util/Hash")} Hash */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** @type {ReadonlySet} */ @@ -217,8 +218,9 @@ class ChunkGraphChunk { class ChunkGraph { /** * @param {ModuleGraph} moduleGraph the module graph + * @param {string | Hash} hashFunction the hash function to use */ - constructor(moduleGraph) { + constructor(moduleGraph, hashFunction = "md4") { /** @private @type {WeakMap} */ this._modules = new WeakMap(); /** @private @type {WeakMap} */ @@ -230,6 +232,8 @@ class ChunkGraph { /** @type {ModuleGraph} */ this.moduleGraph = moduleGraph; + this._hashFunction = hashFunction; + this._getGraphRoots = this._getGraphRoots.bind(this); // Caching @@ -1487,7 +1491,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza cgm.graphHashes = new RuntimeSpecMap(); } const graphHash = cgm.graphHashes.provide(runtime, () => { - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); hash.update(`${cgm.id}`); hash.update(`${this.moduleGraph.isAsync(module)}`); this.moduleGraph.getExportsInfo(module).updateHash(hash, runtime); @@ -1575,7 +1579,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza connectedModules.size > 1 ? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1)) : connectedModules; - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); const addModuleToHash = module => { hash.update( this._getModuleGraphHashBigInt( diff --git a/lib/CodeGenerationResults.js b/lib/CodeGenerationResults.js index 2de8455a847..bea20456019 100644 --- a/lib/CodeGenerationResults.js +++ b/lib/CodeGenerationResults.js @@ -13,12 +13,17 @@ const { runtimeToString, RuntimeSpecMap } = require("./util/runtime"); /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("./Module")} Module */ /** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {typeof import("./util/Hash")} Hash */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ class CodeGenerationResults { - constructor() { + /** + * @param {string | Hash} hashFunction the hash function to use + */ + constructor(hashFunction = "md4") { /** @type {Map>} */ this.map = new Map(); + this._hashFunction = hashFunction; } /** @@ -124,7 +129,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza getHash(module, runtime) { const info = this.get(module, runtime); if (info.hash !== undefined) return info.hash; - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); for (const [type, source] of info.sources) { hash.update(type); source.updateHash(hash); diff --git a/lib/Compilation.js b/lib/Compilation.js index 519df8e1866..8529818d898 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -852,7 +852,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, { managedPaths: compiler.managedPaths, immutablePaths: compiler.immutablePaths, - logger: this.getLogger("webpack.FileSystemInfo") + logger: this.getLogger("webpack.FileSystemInfo"), + hashFunction: compiler.options.output.hashFunction }); if (compiler.fileTimestamps) { this.fileSystemInfo.addFileTimestamps(compiler.fileTimestamps, true); @@ -2255,7 +2256,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.addModuleQueue.clear(); return callback(err); }; - const chunkGraph = new ChunkGraph(this.moduleGraph); + const chunkGraph = new ChunkGraph( + this.moduleGraph, + this.outputOptions.hashFunction + ); this.chunkGraph = chunkGraph; for (const module of this.modules) { @@ -2609,7 +2613,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o codeGeneration(callback) { const { chunkGraph } = this; - this.codeGenerationResults = new CodeGenerationResults(); + this.codeGenerationResults = new CodeGenerationResults( + this.outputOptions.hashFunction + ); /** @type {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} */ const jobs = []; for (const module of this.modules) { @@ -4071,7 +4077,10 @@ This prevents using hashes of each other and should be avoided.`); if (err) return callback(err); // Create new chunk graph, chunk and entrypoint for the build time execution - const chunkGraph = new ChunkGraph(this.moduleGraph); + const chunkGraph = new ChunkGraph( + this.moduleGraph, + this.outputOptions.hashFunction + ); const runtime = "build time"; const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions; @@ -4114,7 +4123,9 @@ This prevents using hashes of each other and should be avoided.`); ); } - const codeGenerationResults = new CodeGenerationResults(); + const codeGenerationResults = new CodeGenerationResults( + this.outputOptions.hashFunction + ); /** @type {WebpackError[]} */ const errors = []; /** diff --git a/lib/Compiler.js b/lib/Compiler.js index 289d360833b..bf30373708b 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -276,7 +276,11 @@ class Compiler { * @returns {CacheFacade} the cache facade instance */ getCache(name) { - return new CacheFacade(this.cache, `${this.compilerPath}${name}`); + return new CacheFacade( + this.cache, + `${this.compilerPath}${name}`, + this.options.output.hashFunction + ); } /** diff --git a/lib/DependencyTemplates.js b/lib/DependencyTemplates.js index 117c05af0e6..767b7e566e7 100644 --- a/lib/DependencyTemplates.js +++ b/lib/DependencyTemplates.js @@ -9,14 +9,20 @@ const createHash = require("./util/createHash"); /** @typedef {import("./Dependency")} Dependency */ /** @typedef {import("./DependencyTemplate")} DependencyTemplate */ +/** @typedef {typeof import("./util/Hash")} Hash */ + /** @typedef {new (...args: any[]) => Dependency} DependencyConstructor */ class DependencyTemplates { - constructor() { + /** + * @param {string | Hash} hashFunction the hash function to use + */ + constructor(hashFunction = "md4") { /** @type {Map} */ this._map = new Map(); /** @type {string} */ this._hash = "31d6cfe0d16ae931b73c59d7e0c089c0"; + this._hashFunction = hashFunction; } /** @@ -41,7 +47,7 @@ class DependencyTemplates { * @returns {void} */ updateHash(part) { - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); hash.update(this._hash); hash.update(part); this._hash = /** @type {string} */ (hash.digest("hex")); diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js index 59c80a00449..803d7869a61 100644 --- a/lib/EvalDevToolModulePlugin.js +++ b/lib/EvalDevToolModulePlugin.js @@ -61,7 +61,8 @@ class EvalDevToolModulePlugin { }, { requestShortener: runtimeTemplate.requestShortener, - chunkGraph + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction } ); const footer = diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js index fefaa2e9e7d..7282ba3f676 100644 --- a/lib/EvalSourceMapDevToolPlugin.js +++ b/lib/EvalSourceMapDevToolPlugin.js @@ -138,7 +138,8 @@ class EvalSourceMapDevToolPlugin { }, { requestShortener: runtimeTemplate.requestShortener, - chunkGraph + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction } ); }); diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index d6b14578f68..a0216b96ca0 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -38,6 +38,7 @@ const { register } = require("./util/serialization"); /** @typedef {import("./WebpackError")} WebpackError */ /** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ /** @typedef {import("./util/Hash")} Hash */ +/** @typedef {typeof import("./util/Hash")} HashConstructor */ /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ @@ -160,11 +161,16 @@ const getSourceForImportExternal = (moduleAndSpecifiers, runtimeTemplate) => { }; class ModuleExternalInitFragment extends InitFragment { - constructor(request, ident) { + /** + * @param {string} request import source + * @param {string=} ident recomputed ident + * @param {string | HashConstructor=} hashFunction the hash function to use + */ + constructor(request, ident, hashFunction = "md4") { if (ident === undefined) { ident = Template.toIdentifier(request); if (ident !== request) { - ident += `_${createHash("md4") + ident += `_${createHash(hashFunction) .update(request) .digest("hex") .slice(0, 8)}`; @@ -230,21 +236,25 @@ const generateModuleRemapping = (input, exportsInfo, runtime) => { }; /** - * @param {string|number} id the module id * @param {string|string[]} moduleAndSpecifiers the module request * @param {ExportsInfo} exportsInfo exports info of this module * @param {RuntimeSpec} runtime the runtime + * @param {string | HashConstructor=} hashFunction the hash function to use * @returns {SourceData} the generated source */ const getSourceForModuleExternal = ( - id, moduleAndSpecifiers, exportsInfo, - runtime + runtime, + hashFunction ) => { if (!Array.isArray(moduleAndSpecifiers)) moduleAndSpecifiers = [moduleAndSpecifiers]; - const initFragment = new ModuleExternalInitFragment(moduleAndSpecifiers[0]); + const initFragment = new ModuleExternalInitFragment( + moduleAndSpecifiers[0], + undefined, + hashFunction + ); const baseAccess = `${initFragment.getNamespaceIdentifier()}${propertyAccess( moduleAndSpecifiers, 1 @@ -566,12 +576,11 @@ class ExternalModule extends Module { "The target environment doesn't support EcmaScriptModule syntax so it's not possible to use external type 'module'" ); } - const id = chunkGraph.getModuleId(this); return getSourceForModuleExternal( - id !== null ? id : this.identifier(), request, moduleGraph.getExportsInfo(this), - runtime + runtime, + runtimeTemplate.outputOptions.hashFunction ); } case "var": diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index 836c4b2fad3..82b04d456ab 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -16,6 +16,7 @@ const processAsyncTree = require("./util/processAsyncTree"); /** @typedef {import("./WebpackError")} WebpackError */ /** @typedef {import("./logging/Logger").Logger} Logger */ +/** @typedef {typeof import("./util/Hash")} Hash */ /** @typedef {import("./util/fs").IStats} IStats */ /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ @@ -856,12 +857,22 @@ class FileSystemInfo { * @param {Iterable=} options.managedPaths paths that are only managed by a package manager * @param {Iterable=} options.immutablePaths paths that are immutable * @param {Logger=} options.logger logger used to log invalid snapshots + * @param {string | Hash=} options.hashFunction the hash function to use */ - constructor(fs, { managedPaths = [], immutablePaths = [], logger } = {}) { + constructor( + fs, + { + managedPaths = [], + immutablePaths = [], + logger, + hashFunction = "md4" + } = {} + ) { this.fs = fs; this.logger = logger; this._remainingLogs = logger ? 40 : 0; this._loggedPaths = logger ? new Set() : undefined; + this._hashFunction = hashFunction; /** @type {WeakMap} */ this._snapshotCache = new WeakMap(); this._fileTimestampsOptimization = new SnapshotOptimization( @@ -2793,7 +2804,7 @@ class FileSystemInfo { return callback(err); } - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); hash.update(content); @@ -2976,7 +2987,7 @@ class FileSystemInfo { reduce: (files, tsEntries) => { let symlinks = undefined; - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); for (const file of files) hash.update(file); let safeTime = 0; @@ -3044,7 +3055,7 @@ class FileSystemInfo { }, err => { if (err) return callback(err); - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); hash.update(entry.timestampHash); if (entry.safeTime) { safeTime = Math.max(safeTime, entry.safeTime); @@ -3094,7 +3105,7 @@ class FileSystemInfo { */ reduce: (files, fileHashes) => { let symlinks = undefined; - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); for (const file of files) hash.update(file); for (const entry of fileHashes) { @@ -3143,7 +3154,7 @@ class FileSystemInfo { }, err => { if (err) return callback(err); - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); hash.update(entry.hash); hashes.sort(); for (const h of hashes) { @@ -3221,8 +3232,8 @@ class FileSystemInfo { reduce: (files, results) => { let symlinks = undefined; - const tsHash = createHash("md4"); - const hash = createHash("md4"); + const tsHash = createHash(this._hashFunction); + const hash = createHash(this._hashFunction); for (const file of files) { tsHash.update(file); @@ -3300,8 +3311,8 @@ class FileSystemInfo { }, err => { if (err) return callback(err); - const hash = createHash("md4"); - const tsHash = createHash("md4"); + const hash = createHash(this._hashFunction); + const tsHash = createHash(this._hashFunction); hash.update(entry.hash); if (entry.timestampHash) tsHash.update(entry.timestampHash); if (entry.safeTime) { diff --git a/lib/ModuleFilenameHelpers.js b/lib/ModuleFilenameHelpers.js index 56c0026374e..4c958ab638d 100644 --- a/lib/ModuleFilenameHelpers.js +++ b/lib/ModuleFilenameHelpers.js @@ -8,6 +8,11 @@ const createHash = require("./util/createHash"); const memoize = require("./util/memoize"); +/** @typedef {import("./ChunkGraph")} ChunkGraph */ +/** @typedef {import("./Module")} Module */ +/** @typedef {import("./RequestShortener")} RequestShortener */ +/** @typedef {typeof import("./util/Hash")} Hash */ + const ModuleFilenameHelpers = exports; // TODO webpack 6: consider removing these @@ -53,9 +58,9 @@ const getBefore = (strFn, token) => { }; }; -const getHash = strFn => { +const getHash = (strFn, hashFunction) => { return () => { - const hash = createHash("md4"); + const hash = createHash(hashFunction); hash.update(strFn()); const digest = /** @type {string} */ (hash.digest("hex")); return digest.substr(0, 4); @@ -91,10 +96,20 @@ const lazyObject = obj => { const REGEXP = /\[\\*([\w-]+)\\*\]/gi; +/** + * + * @param {Module | string} module the module + * @param {TODO} options options + * @param {Object} contextInfo context info + * @param {RequestShortener} contextInfo.requestShortener requestShortener + * @param {ChunkGraph} contextInfo.chunkGraph chunk graph + * @param {string | Hash} contextInfo.hashFunction the hash function to use + * @returns {string} the filename + */ ModuleFilenameHelpers.createFilename = ( - module, + module = "", options, - { requestShortener, chunkGraph } + { requestShortener, chunkGraph, hashFunction = "md4" } ) => { const opts = { namespace: "", @@ -111,13 +126,12 @@ ModuleFilenameHelpers.createFilename = ( let identifier; let moduleId; let shortIdentifier; - if (module === undefined) module = ""; if (typeof module === "string") { shortIdentifier = memoize(() => requestShortener.shorten(module)); identifier = shortIdentifier; moduleId = () => ""; absoluteResourcePath = () => module.split("!").pop(); - hash = getHash(identifier); + hash = getHash(identifier, hashFunction); } else { shortIdentifier = memoize(() => module.readableIdentifier(requestShortener) @@ -125,7 +139,7 @@ ModuleFilenameHelpers.createFilename = ( identifier = memoize(() => requestShortener.shorten(module.identifier())); moduleId = () => chunkGraph.getModuleId(module); absoluteResourcePath = () => module.identifier().split("!").pop(); - hash = getHash(identifier); + hash = getHash(identifier, hashFunction); } const resource = memoize(() => shortIdentifier().split("!").pop()); diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index f5e0e86bb36..fc5a3dcf287 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -297,7 +297,8 @@ class SourceMapDevToolPlugin { }, { requestShortener, - chunkGraph + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction } ) ); @@ -358,7 +359,8 @@ class SourceMapDevToolPlugin { }, { requestShortener, - chunkGraph + chunkGraph, + hashFunction: compilation.outputOptions.hashFunction } ); hasName = usedNamesSet.has(sourceName); @@ -442,7 +444,9 @@ class SourceMapDevToolPlugin { const sourceMapContentHash = usesContentHash && /** @type {string} */ ( - createHash("md4").update(sourceMapString).digest("hex") + createHash(compilation.outputOptions.hashFunction) + .update(sourceMapString) + .digest("hex") ); const pathParams = { chunk, diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index d3a5da51f91..a1dc892cf30 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -431,7 +431,9 @@ class WebpackOptionsApply extends OptionsApply { "hashed", "deterministic" ).apply(compiler); - new HashedModuleIdsPlugin().apply(compiler); + new HashedModuleIdsPlugin({ + hashFunction: options.output.hashFunction + }).apply(compiler); break; } case "deterministic": { diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index d940689f7e9..5eeebe7892f 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -995,7 +995,8 @@ class PackFileCacheStrategy { this.fileSystemInfo = new FileSystemInfo(fs, { managedPaths: snapshot.managedPaths, immutablePaths: snapshot.immutablePaths, - logger: logger.getChildLogger("webpack.FileSystemInfo") + logger: logger.getChildLogger("webpack.FileSystemInfo"), + hashFunction: compiler.options.output.hashFunction }); this.compiler = compiler; this.context = context; diff --git a/lib/cache/getLazyHashedEtag.js b/lib/cache/getLazyHashedEtag.js index 09cd9f0ec77..6cdf6c3abb7 100644 --- a/lib/cache/getLazyHashedEtag.js +++ b/lib/cache/getLazyHashedEtag.js @@ -8,6 +8,7 @@ const createHash = require("../util/createHash"); /** @typedef {import("../util/Hash")} Hash */ +/** @typedef {typeof import("../util/Hash")} HashConstructor */ /** * @typedef {Object} HashableObject @@ -17,10 +18,12 @@ const createHash = require("../util/createHash"); class LazyHashedEtag { /** * @param {HashableObject} obj object with updateHash method + * @param {string | HashConstructor} hashFunction the hash function to use */ - constructor(obj) { + constructor(obj, hashFunction = "md4") { this._obj = obj; this._hash = undefined; + this._hashFunction = hashFunction; } /** @@ -28,7 +31,7 @@ class LazyHashedEtag { */ toString() { if (this._hash === undefined) { - const hash = createHash("md4"); + const hash = createHash(this._hashFunction); this._obj.updateHash(hash); this._hash = /** @type {string} */ (hash.digest("base64")); } @@ -36,18 +39,42 @@ class LazyHashedEtag { } } -/** @type {WeakMap} */ -const map = new WeakMap(); +/** @type {Map>} */ +const mapStrings = new Map(); + +/** @type {WeakMap>} */ +const mapObjects = new WeakMap(); /** * @param {HashableObject} obj object with updateHash method + * @param {string | HashConstructor} hashFunction the hash function to use * @returns {LazyHashedEtag} etag */ -const getter = obj => { - const hash = map.get(obj); +const getter = (obj, hashFunction = "md4") => { + let innerMap; + if (typeof hashFunction === "string") { + innerMap = mapStrings.get(hashFunction); + if (innerMap === undefined) { + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap = new WeakMap(); + innerMap.set(obj, newHash); + mapStrings.set(hashFunction, innerMap); + return newHash; + } + } else { + innerMap = mapObjects.get(hashFunction); + if (innerMap === undefined) { + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap = new WeakMap(); + innerMap.set(obj, newHash); + mapObjects.set(hashFunction, innerMap); + return newHash; + } + } + const hash = innerMap.get(obj); if (hash !== undefined) return hash; - const newHash = new LazyHashedEtag(obj); - map.set(obj, newHash); + const newHash = new LazyHashedEtag(obj, hashFunction); + innerMap.set(obj, newHash); return newHash; }; diff --git a/lib/ids/IdHelpers.js b/lib/ids/IdHelpers.js index e5e2be5f25d..289614dc903 100644 --- a/lib/ids/IdHelpers.js +++ b/lib/ids/IdHelpers.js @@ -13,14 +13,16 @@ const numberHash = require("../util/numberHash"); /** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Module")} Module */ +/** @typedef {typeof import("../util/Hash")} Hash */ /** * @param {string} str string to hash * @param {number} len max length of the hash + * @param {string | Hash} hashFunction hash function to use * @returns {string} hash */ -const getHash = (str, len) => { - const hash = createHash("md4"); +const getHash = (str, len, hashFunction) => { + const hash = createHash(hashFunction); hash.update(str); const digest = /** @type {string} */ (hash.digest("hex")); return digest.substr(0, len); @@ -61,12 +63,15 @@ exports.requestToId = requestToId; /** * @param {string} string the string * @param {string} delimiter separator for string and hash + * @param {string | Hash} hashFunction hash function to use * @returns {string} string with limited max length to 100 chars */ -const shortenLongString = (string, delimiter) => { +const shortenLongString = (string, delimiter, hashFunction) => { if (string.length < 100) return string; return ( - string.slice(0, 100 - 6 - delimiter.length) + delimiter + getHash(string, 6) + string.slice(0, 100 - 6 - delimiter.length) + + delimiter + + getHash(string, 6, hashFunction) ); }; @@ -92,6 +97,7 @@ exports.getShortModuleName = getShortModuleName; * @param {string} shortName the short name * @param {Module} module the module * @param {string} context context directory + * @param {string | Hash} hashFunction hash function to use * @param {Object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} long module name */ @@ -99,10 +105,11 @@ const getLongModuleName = ( shortName, module, context, + hashFunction, associatedObjectForCache ) => { const fullName = getFullModuleName(module, context, associatedObjectForCache); - return `${shortName}?${getHash(fullName, 4)}`; + return `${shortName}?${getHash(fullName, 4, hashFunction)}`; }; exports.getLongModuleName = getLongModuleName; @@ -126,6 +133,7 @@ exports.getFullModuleName = getFullModuleName; * @param {ChunkGraph} chunkGraph the chunk graph * @param {string} context context directory * @param {string} delimiter delimiter for names + * @param {string | Hash} hashFunction hash function to use * @param {Object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} short chunk name */ @@ -134,6 +142,7 @@ const getShortChunkName = ( chunkGraph, context, delimiter, + hashFunction, associatedObjectForCache ) => { const modules = chunkGraph.getChunkRootModules(chunk); @@ -145,7 +154,7 @@ const getShortChunkName = ( .concat(shortModuleNames) .filter(Boolean) .join(delimiter); - return shortenLongString(chunkName, delimiter); + return shortenLongString(chunkName, delimiter, hashFunction); }; exports.getShortChunkName = getShortChunkName; @@ -154,6 +163,7 @@ exports.getShortChunkName = getShortChunkName; * @param {ChunkGraph} chunkGraph the chunk graph * @param {string} context context directory * @param {string} delimiter delimiter for names + * @param {string | Hash} hashFunction hash function to use * @param {Object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} short chunk name */ @@ -162,6 +172,7 @@ const getLongChunkName = ( chunkGraph, context, delimiter, + hashFunction, associatedObjectForCache ) => { const modules = chunkGraph.getChunkRootModules(chunk); @@ -169,14 +180,16 @@ const getLongChunkName = ( requestToId(getShortModuleName(m, context, associatedObjectForCache)) ); const longModuleNames = modules.map(m => - requestToId(getLongModuleName("", m, context, associatedObjectForCache)) + requestToId( + getLongModuleName("", m, context, hashFunction, associatedObjectForCache) + ) ); chunk.idNameHints.sort(); const chunkName = Array.from(chunk.idNameHints) .concat(shortModuleNames, longModuleNames) .filter(Boolean) .join(delimiter); - return shortenLongString(chunkName, delimiter); + return shortenLongString(chunkName, delimiter, hashFunction); }; exports.getLongChunkName = getLongChunkName; diff --git a/lib/ids/NamedChunkIdsPlugin.js b/lib/ids/NamedChunkIdsPlugin.js index 5e31629f927..1b5c8752ecd 100644 --- a/lib/ids/NamedChunkIdsPlugin.js +++ b/lib/ids/NamedChunkIdsPlugin.js @@ -31,6 +31,7 @@ class NamedChunkIdsPlugin { */ apply(compiler) { compiler.hooks.compilation.tap("NamedChunkIdsPlugin", compilation => { + const { hashFunction } = compilation.outputOptions; compilation.hooks.chunkIds.tap("NamedChunkIdsPlugin", chunks => { const chunkGraph = compilation.chunkGraph; const context = this.context ? this.context : compiler.context; @@ -50,6 +51,7 @@ class NamedChunkIdsPlugin { chunkGraph, context, delimiter, + hashFunction, compiler.root ), chunk => @@ -58,6 +60,7 @@ class NamedChunkIdsPlugin { chunkGraph, context, delimiter, + hashFunction, compiler.root ), compareChunksNatural(chunkGraph), diff --git a/lib/ids/NamedModuleIdsPlugin.js b/lib/ids/NamedModuleIdsPlugin.js index 3329f45b9d0..92de442d68e 100644 --- a/lib/ids/NamedModuleIdsPlugin.js +++ b/lib/ids/NamedModuleIdsPlugin.js @@ -30,6 +30,7 @@ class NamedModuleIdsPlugin { apply(compiler) { const { root } = compiler; compiler.hooks.compilation.tap("NamedModuleIdsPlugin", compilation => { + const { hashFunction } = compilation.outputOptions; compilation.hooks.moduleIds.tap("NamedModuleIdsPlugin", modules => { const chunkGraph = compilation.chunkGraph; const context = this.options.context @@ -43,7 +44,8 @@ class NamedModuleIdsPlugin { return chunkGraph.getModuleId(module) === null; }), m => getShortModuleName(m, context, root), - (m, shortName) => getLongModuleName(shortName, m, context, root), + (m, shortName) => + getLongModuleName(shortName, m, context, hashFunction, root), compareModulesByIdentifier, getUsedModuleIds(compilation), (m, name) => chunkGraph.setModuleId(m, name) diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index 8b7dca47301..613d205e9a4 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -58,6 +58,7 @@ const { /** @typedef {import("../WebpackError")} WebpackError */ /** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ /** @typedef {import("../util/Hash")} Hash */ +/** @typedef {typeof import("../util/Hash")} HashConstructor */ /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ @@ -647,13 +648,21 @@ class ConcatenatedModule extends Module { * @param {Set} modules all modules in the concatenation (including the root module) * @param {RuntimeSpec} runtime the runtime * @param {Object=} associatedObjectForCache object for caching + * @param {string | HashConstructor=} hashFunction hash function to use * @returns {ConcatenatedModule} the module */ - static create(rootModule, modules, runtime, associatedObjectForCache) { + static create( + rootModule, + modules, + runtime, + associatedObjectForCache, + hashFunction = "md4" + ) { const identifier = ConcatenatedModule._createIdentifier( rootModule, modules, - associatedObjectForCache + associatedObjectForCache, + hashFunction ); return new ConcatenatedModule({ identifier, @@ -1010,7 +1019,19 @@ class ConcatenatedModule extends Module { return list; } - static _createIdentifier(rootModule, modules, associatedObjectForCache) { + /** + * @param {Module} rootModule the root module of the concatenation + * @param {Set} modules all modules in the concatenation (including the root module) + * @param {Object=} associatedObjectForCache object for caching + * @param {string | HashConstructor=} hashFunction hash function to use + * @returns {string} the identifier + */ + static _createIdentifier( + rootModule, + modules, + associatedObjectForCache, + hashFunction = "md4" + ) { const cachedMakePathsRelative = makePathsRelative.bindContextCache( rootModule.context, associatedObjectForCache @@ -1020,7 +1041,7 @@ class ConcatenatedModule extends Module { identifiers.push(cachedMakePathsRelative(module.identifier())); } identifiers.sort(); - const hash = createHash("md4"); + const hash = createHash(hashFunction); hash.update(identifiers.join(" ")); return rootModule.identifier() + "|" + hash.digest("hex"); } diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index 12e13cda77d..1ebb7f66feb 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -366,7 +366,8 @@ class ModuleConcatenationPlugin { rootModule, modules, concatConfiguration.runtime, - compiler.root + compiler.root, + compilation.outputOptions.hashFunction ); const build = () => { diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index 52c79490c21..cf0b1d3dad5 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -311,8 +311,7 @@ class HttpUriPlugin { : lockfileLocation + ".data"; const upgrade = this._upgrade || false; const frozen = this._frozen || false; - const hashFunction = - this._hashFunction || compilation.outputOptions.hashFunction; + const hashFunction = this._hashFunction || "sha512"; const hashDigest = this._hashDigest || compilation.outputOptions.hashDigest; const hashDigestLength = diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index c50918cf674..fb14a2708ae 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -18,6 +18,7 @@ const { dirname, join, mkdirp } = require("../util/fs"); const memoize = require("../util/memoize"); const SerializerMiddleware = require("./SerializerMiddleware"); +/** @typedef {typeof import("../util/Hash")} Hash */ /** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ /** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ @@ -39,8 +40,14 @@ Section -> Buffer // "wpc" + 1 in little-endian const VERSION = 0x01637077; -const hashForName = buffers => { - const hash = createHash("md4"); + +/** + * @param {Buffer[]} buffers buffers + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash + */ +const hashForName = (buffers, hashFunction) => { + const hash = createHash(hashFunction); for (const buf of buffers) hash.update(buf); return /** @type {string} */ (hash.digest("hex")); }; @@ -81,9 +88,16 @@ const readUInt64LE = Buffer.prototype.readBigUInt64LE * @param {BufferSerializableType[] | Promise} data data to be serialized * @param {string | boolean} name file base name * @param {function(string | false, Buffer[]): Promise} writeFile writes a file + * @param {string | Hash} hashFunction hash function to use * @returns {Promise} resulting file pointer and promise */ -const serialize = async (middleware, data, name, writeFile) => { +const serialize = async ( + middleware, + data, + name, + writeFile, + hashFunction = "md4" +) => { /** @type {(Buffer[] | Buffer | SerializeResult | Promise)[]} */ const processedData = []; /** @type {WeakMap>} */ @@ -118,7 +132,8 @@ const serialize = async (middleware, data, name, writeFile) => { middleware, content, (options && options.name) || true, - writeFile + writeFile, + hashFunction ).then(result => { /** @type {any} */ (item).options.size = result.size; resultToLazy.set(result, item); @@ -195,7 +210,7 @@ const serialize = async (middleware, data, name, writeFile) => { } } if (name === true) { - name = hashForName(buf); + name = hashForName(buf, hashFunction); } backgroundJobs.push(writeFile(name, buf)); let size = 0; @@ -386,10 +401,12 @@ const deserialize = async (middleware, name, readFile) => { class FileMiddleware extends SerializerMiddleware { /** * @param {IntermediateFileSystem} fs filesystem + * @param {string | Hash} hashFunction hash function to use */ - constructor(fs) { + constructor(fs, hashFunction = "md4") { super(); this.fs = fs; + this._hashFunction = hashFunction; } /** * @param {DeserializedType} data data @@ -446,7 +463,7 @@ class FileMiddleware extends SerializerMiddleware { }; resolve( - serialize(this, data, false, writeFile).then( + serialize(this, data, false, writeFile, this._hashFunction).then( async ({ backgroundJob }) => { await backgroundJob; diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index ad7e3f08358..9d48d2d7315 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -15,6 +15,7 @@ const RegExpObjectSerializer = require("./RegExpObjectSerializer"); const SerializerMiddleware = require("./SerializerMiddleware"); const SetObjectSerializer = require("./SetObjectSerializer"); +/** @typedef {typeof import("../util/Hash")} Hash */ /** @typedef {import("./types").ComplexSerializableType} ComplexSerializableType */ /** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ @@ -76,8 +77,13 @@ const setMapSize = (map, size) => { } }; -const toHash = buffer => { - const hash = createHash("md4"); +/** + * @param {Buffer} buffer buffer + * @param {string | Hash} hashFunction hash function to use + * @returns {string} hash + */ +const toHash = (buffer, hashFunction) => { + const hash = createHash(hashFunction); hash.update(buffer); return /** @type {string} */ (hash.digest("latin1")); }; @@ -149,9 +155,14 @@ const loaders = new Map(); * @extends {SerializerMiddleware} */ class ObjectMiddleware extends SerializerMiddleware { - constructor(extendContext) { + /** + * @param {function(any): void} extendContext context extensions + * @param {string | Hash} hashFunction hash function to use + */ + constructor(extendContext, hashFunction = "md4") { super(); this.extendContext = extendContext; + this._hashFunction = hashFunction; } /** * @param {RegExp} regExp RegExp for which the request is tested @@ -275,11 +286,11 @@ class ObjectMiddleware extends SerializerMiddleware { bufferDedupeMap.set(len, [entry, buf]); return buf; } else { - const hash = toHash(entry); + const hash = toHash(entry, this._hashFunction); const newMap = new Map(); newMap.set(hash, entry); bufferDedupeMap.set(len, newMap); - const hashBuf = toHash(buf); + const hashBuf = toHash(buf, this._hashFunction); if (hash === hashBuf) { return entry; } @@ -296,10 +307,10 @@ class ObjectMiddleware extends SerializerMiddleware { return buf; } else { const newMap = new Map(); - const hash = toHash(buf); + const hash = toHash(buf, this._hashFunction); let found; for (const item of entry) { - const itemHash = toHash(item); + const itemHash = toHash(item, this._hashFunction); newMap.set(itemHash, item); if (found === undefined && itemHash === hash) found = item; } @@ -312,7 +323,7 @@ class ObjectMiddleware extends SerializerMiddleware { } } } else { - const hash = toHash(buf); + const hash = toHash(buf, this._hashFunction); const item = entry.get(hash); if (item !== undefined) { return item; diff --git a/lib/util/serialization.js b/lib/util/serialization.js index cc3bf61cda2..6d4eb959075 100644 --- a/lib/util/serialization.js +++ b/lib/util/serialization.js @@ -89,15 +89,15 @@ module.exports = { ); }; } - }), + }, "md4"), binaryMiddleware ])); }, - createFileSerializer: fs => { + createFileSerializer: (fs, hashFunction) => { registerSerializers(); const Serializer = getSerializer(); const FileMiddleware = require("../serialization/FileMiddleware"); - const fileMiddleware = new FileMiddleware(fs); + const fileMiddleware = new FileMiddleware(fs, hashFunction); const binaryMiddleware = getBinaryMiddlewareInstance(); const SerializerMiddleware = getSerializerMiddleware(); const SingleItemMiddleware = getSingleItemMiddleware(); @@ -120,7 +120,7 @@ module.exports = { return lazy; }; } - }), + }, hashFunction), binaryMiddleware, fileMiddleware ]); diff --git a/package.json b/package.json index 01ee0ee60be..3b9c1dba8fd 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "style-loader": "^2.0.0", "terser": "^5.7.0", "toml": "^3.0.0", - "tooling": "webpack/tooling#v1.19.0", + "tooling": "webpack/tooling#v1.20.0", "ts-loader": "^8.0.2", "typescript": "^4.2.0-beta", "url-loader": "^4.1.0", diff --git a/schemas/plugins/HashedModuleIdsPlugin.check.js b/schemas/plugins/HashedModuleIdsPlugin.check.js index 1f1b35cfc31..8eaa566deb2 100644 --- a/schemas/plugins/HashedModuleIdsPlugin.check.js +++ b/schemas/plugins/HashedModuleIdsPlugin.check.js @@ -3,4 +3,4 @@ * DO NOT MODIFY BY HAND. * Run `yarn special-lint-fix` to update */ -const r=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function t(e,{instancePath:s="",parentData:i,parentDataProperty:n,rootData:a=e}={}){if(!e||"object"!=typeof e||Array.isArray(e))return t.errors=[{params:{type:"object"}}],!1;{const s=0;for(const r in e)if("context"!==r&&"hashDigest"!==r&&"hashDigestLength"!==r&&"hashFunction"!==r)return t.errors=[{params:{additionalProperty:r}}],!1;if(0===s){if(void 0!==e.context){let s=e.context;const i=0;if(0===i){if("string"!=typeof s)return t.errors=[{params:{type:"string"}}],!1;if(s.includes("!")||!0!==r.test(s))return t.errors=[{params:{}}],!1}var o=0===i}else o=!0;if(o){if(void 0!==e.hashDigest){let r=e.hashDigest;const s=0;if("hex"!==r&&"latin1"!==r&&"base64"!==r)return t.errors=[{params:{}}],!1;o=0===s}else o=!0;if(o){if(void 0!==e.hashDigestLength){let r=e.hashDigestLength;const s=0;if(0===s){if("number"!=typeof r||!isFinite(r))return t.errors=[{params:{type:"number"}}],!1;if(r<1||isNaN(r))return t.errors=[{params:{comparison:">=",limit:1}}],!1}o=0===s}else o=!0;if(o)if(void 0!==e.hashFunction){let r=e.hashFunction;const s=0;if(0===s){if("string"!=typeof r)return t.errors=[{params:{type:"string"}}],!1;if(r.length<1)return t.errors=[{params:{}}],!1}o=0===s}else o=!0}}}}return t.errors=null,!0}module.exports=t,module.exports.default=t; \ No newline at end of file +const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function e(r,{instancePath:s="",parentData:n,parentDataProperty:i,rootData:a=r}={}){let o=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const s=l;for(const t in r)if("context"!==t&&"hashDigest"!==t&&"hashDigestLength"!==t&&"hashFunction"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(s===l){if(void 0!==r.context){let s=r.context;const n=l;if(l===n){if("string"!=typeof s)return e.errors=[{params:{type:"string"}}],!1;if(s.includes("!")||!0!==t.test(s))return e.errors=[{params:{}}],!1}var u=n===l}else u=!0;if(u){if(void 0!==r.hashDigest){let t=r.hashDigest;const s=l;if("hex"!==t&&"latin1"!==t&&"base64"!==t)return e.errors=[{params:{}}],!1;u=s===l}else u=!0;if(u){if(void 0!==r.hashDigestLength){let t=r.hashDigestLength;const s=l;if(l===s){if("number"!=typeof t||!isFinite(t))return e.errors=[{params:{type:"number"}}],!1;if(t<1||isNaN(t))return e.errors=[{params:{comparison:">=",limit:1}}],!1}u=s===l}else u=!0;if(u)if(void 0!==r.hashFunction){let t=r.hashFunction;const s=l,n=l;let i=!1,a=null;const p=l,h=l;let c=!1;const m=l;if(l===m)if("string"==typeof t){if(t.length<1){const t={params:{}};null===o?o=[t]:o.push(t),l++}}else{const t={params:{type:"string"}};null===o?o=[t]:o.push(t),l++}var f=m===l;if(c=c||f,!c){const e=l;if(!(t instanceof Function)){const t={params:{}};null===o?o=[t]:o.push(t),l++}f=e===l,c=c||f}if(c)l=h,null!==o&&(h?o.length=h:o=null);else{const t={params:{}};null===o?o=[t]:o.push(t),l++}if(p===l&&(i=!0,a=0),!i){const t={params:{passingSchemas:a}};return null===o?o=[t]:o.push(t),l++,e.errors=o,!1}l=n,null!==o&&(n?o.length=n:o=null),u=s===l}else u=!0}}}}}return e.errors=o,0===l}module.exports=e,module.exports.default=e; \ No newline at end of file diff --git a/schemas/plugins/HashedModuleIdsPlugin.json b/schemas/plugins/HashedModuleIdsPlugin.json index b365a851b91..1b4efc40b5e 100644 --- a/schemas/plugins/HashedModuleIdsPlugin.json +++ b/schemas/plugins/HashedModuleIdsPlugin.json @@ -1,4 +1,19 @@ { + "definitions": { + "HashFunction": { + "description": "Algorithm used for generation the hash (see node.js crypto package).", + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "instanceof": "Function", + "tsType": "typeof import('../../lib/util/Hash')" + } + ] + } + }, "title": "HashedModuleIdsPluginOptions", "type": "object", "additionalProperties": false, @@ -19,8 +34,11 @@ }, "hashFunction": { "description": "The hashing algorithm to use, defaults to 'md4'. All functions from Node.JS' crypto.createHash are supported.", - "type": "string", - "minLength": 1 + "oneOf": [ + { + "$ref": "#/definitions/HashFunction" + } + ] } } } diff --git a/test/FileSystemInfo.unittest.js b/test/FileSystemInfo.unittest.js index f56f96ae381..934990b65f5 100644 --- a/test/FileSystemInfo.unittest.js +++ b/test/FileSystemInfo.unittest.js @@ -111,7 +111,8 @@ describe("FileSystemInfo", () => { const fsInfo = new FileSystemInfo(fs, { logger, managedPaths, - immutablePaths + immutablePaths, + hashFunction: "sha256" }); for (const method of ["warn", "info", "log", "debug"]) { fsInfo.logs = []; diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_46e6c8f1b2a5b24fb643.txt b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_72216076a225ea0abbaa.txt similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_46e6c8f1b2a5b24fb643.txt rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_72216076a225ea0abbaa.txt diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_query_36fd3967a266e1b0a996.txt b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_query_590ffbc5acc20bf1dc88.txt similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_query_36fd3967a266e1b0a996.txt rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/asset_query_590ffbc5acc20bf1dc88.txt diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_ba99384fb6c83b67f435.js b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_3263dc642c8ad1171873.js similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_ba99384fb6c83b67f435.js rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_3263dc642c8ad1171873.js diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_fe244ae613f6967e2f8b.js b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_f750536150de4f4db445.js similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_fe244ae613f6967e2f8b.js rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_f750536150de4f4db445.js diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_f335316192eeeb416b57.js b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_a662b3b186898f776088.js similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_f335316192eeeb416b57.js rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_a662b3b186898f776088.js diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_cache_071c12a46730e2dedd60.css b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_cache_071c12a46730e2dedd60.css rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/url_8a6f05a316d16626dc87.js b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/url_cc93d527a81c32b07ab8.js similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/url_8a6f05a316d16626dc87.js rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/http_localhost_9990/url_cc93d527a81c32b07ab8.js diff --git a/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md b/test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md similarity index 100% rename from test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md rename to test/configCases/asset-modules/http-url/dev-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md diff --git a/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js b/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js similarity index 100% rename from test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js rename to test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js diff --git a/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/index_f3181eddde77a03ff311.css b/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css similarity index 100% rename from test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/index_f3181eddde77a03ff311.css rename to test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css diff --git a/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js b/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js similarity index 100% rename from test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js rename to test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js diff --git a/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js b/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js similarity index 100% rename from test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js rename to test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js diff --git a/test/configCases/asset-modules/http-url/errors.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md b/test/configCases/asset-modules/http-url/errors.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md similarity index 100% rename from test/configCases/asset-modules/http-url/errors.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md rename to test/configCases/asset-modules/http-url/errors.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_46e6c8f1b2a5b24fb643.txt b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_72216076a225ea0abbaa.txt similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_46e6c8f1b2a5b24fb643.txt rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_72216076a225ea0abbaa.txt diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_query_36fd3967a266e1b0a996.txt b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_query_590ffbc5acc20bf1dc88.txt similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_query_36fd3967a266e1b0a996.txt rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/asset_query_590ffbc5acc20bf1dc88.txt diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_dependency_ba99384fb6c83b67f435.js b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_dependency_3263dc642c8ad1171873.js similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_dependency_ba99384fb6c83b67f435.js rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_dependency_3263dc642c8ad1171873.js diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_fe244ae613f6967e2f8b.js b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_f750536150de4f4db445.js similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_fe244ae613f6967e2f8b.js rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_f750536150de4f4db445.js diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency_f335316192eeeb416b57.js b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency_a662b3b186898f776088.js similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency_f335316192eeeb416b57.js rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/folder_sub-dependency_a662b3b186898f776088.js diff --git a/test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css similarity index 100% rename from test/configCases/asset-modules/http-url/errors.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_cache_071c12a46730e2dedd60.css b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_cache_071c12a46730e2dedd60.css rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/url_8a6f05a316d16626dc87.js b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/url_cc93d527a81c32b07ab8.js similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/url_8a6f05a316d16626dc87.js rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/url_cc93d527a81c32b07ab8.js diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md b/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md rename to test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_46e6c8f1b2a5b24fb643.txt b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_72216076a225ea0abbaa.txt similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_46e6c8f1b2a5b24fb643.txt rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_72216076a225ea0abbaa.txt diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_query_36fd3967a266e1b0a996.txt b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_query_590ffbc5acc20bf1dc88.txt similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_query_36fd3967a266e1b0a996.txt rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/asset_query_590ffbc5acc20bf1dc88.txt diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/fallback_8ab931cdbc2812bdc302.js rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/fallback_4972219bd28762fbfd18.js diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_ba99384fb6c83b67f435.js b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_3263dc642c8ad1171873.js similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_ba99384fb6c83b67f435.js rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_dependency_3263dc642c8ad1171873.js diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_fe244ae613f6967e2f8b.js b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_f750536150de4f4db445.js similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_fe244ae613f6967e2f8b.js rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency2_f750536150de4f4db445.js diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_f335316192eeeb416b57.js b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_a662b3b186898f776088.js similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_f335316192eeeb416b57.js rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/folder_sub-dependency_a662b3b186898f776088.js diff --git a/test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css similarity index 100% rename from test/configCases/asset-modules/http-url/frozen-verify.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_cache_502725659b59ae63a82a.css diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css deleted file mode 100644 index b978c1b5980..00000000000 --- a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_query_004fef5280e02f70d9a7.css +++ /dev/null @@ -1 +0,0 @@ -a {} \ No newline at end of file diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_cache_071c12a46730e2dedd60.css b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_cache_071c12a46730e2dedd60.css rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/index_query_169a64b251bcdc02a084.css diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/redirect_06486fd663ea9c13ee91.js rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/redirect_d3dcf71bcf15dc29654c.js diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/resolve_e754563143efbab1c458.js rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/resolve_69c3f44e55195d0c14cf.js diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/url_8a6f05a316d16626dc87.js b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/url_cc93d527a81c32b07ab8.js similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/url_8a6f05a316d16626dc87.js rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/http_localhost_9990/url_cc93d527a81c32b07ab8.js diff --git a/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md b/test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md similarity index 100% rename from test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_134f75ac3260537b8472.md rename to test/configCases/asset-modules/http-url/prod-defaults.webpack.lock.data/https_raw.githubusercontent.com/webpack_webpack_main_CODE_OF_CONDUCT_06e7b335922db99b918d.md diff --git a/types.d.ts b/types.d.ts index 0d0634b6b2c..f44cb2bb73b 100644 --- a/types.d.ts +++ b/types.d.ts @@ -759,7 +759,7 @@ declare class Chunk { ): Record>; } declare class ChunkGraph { - constructor(moduleGraph: ModuleGraph); + constructor(moduleGraph: ModuleGraph, hashFunction?: string | typeof Hash); moduleGraph: ModuleGraph; connectChunkAndModule(chunk: Chunk, module: Module): void; disconnectChunkAndModule(chunk: Chunk, module: Module): void; @@ -4306,7 +4306,7 @@ declare interface HashedModuleIdsPluginOptions { /** * The hashing algorithm to use, defaults to 'md4'. All functions from Node.JS' crypto.createHash are supported. */ - hashFunction?: string; + hashFunction?: string | typeof Hash; } declare abstract class HelperRuntimeModule extends RuntimeModule {} declare class HotModuleReplacementPlugin { @@ -12022,10 +12022,23 @@ declare namespace exports { export let NAMESPACE: string; export let REGEXP_NAMESPACE: RegExp; export let createFilename: ( - module: any, + module: string | Module, options: any, - __2: { requestShortener: any; chunkGraph: any } - ) => any; + __2: { + /** + * requestShortener + */ + requestShortener: RequestShortener; + /** + * chunk graph + */ + chunkGraph: ChunkGraph; + /** + * the hash function to use + */ + hashFunction: string | typeof Hash; + } + ) => string; export let replaceDuplicates: ( array?: any, fn?: any, @@ -12281,7 +12294,10 @@ declare namespace exports { export const registerNotSerializable: (Constructor: Constructor) => void; export const NOT_SERIALIZABLE: object; export const buffersSerializer: Serializer; - export let createFileSerializer: (fs?: any) => Serializer; + export let createFileSerializer: ( + fs?: any, + hashFunction?: any + ) => Serializer; export { MEASURE_START_OPERATION, MEASURE_END_OPERATION }; } export const cleverMerge: (first: T, second: O) => T | O | (T & O); diff --git a/yarn.lock b/yarn.lock index c46afdcee38..1d72f9d9dd2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5782,9 +5782,9 @@ toml@^3.0.0: resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== -tooling@webpack/tooling#v1.19.0: - version "1.19.0" - resolved "https://codeload.github.com/webpack/tooling/tar.gz/6b7567edcd6d93f5e5dc1df8364e0b1204edcac3" +tooling@webpack/tooling#v1.20.0: + version "1.20.0" + resolved "https://codeload.github.com/webpack/tooling/tar.gz/ddaacde8cbc468eb6473bee0c3547477d365f3f2" dependencies: "@yarnpkg/lockfile" "^1.1.0" ajv "^8.1.0" From 3f142d9cd6435be27991fd932550148890b251e3 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 23 Sep 2021 12:55:18 +0200 Subject: [PATCH 13/34] allows to select `xxhash64` as hashFunction --- .gitignore | 2 + assembly/hash/xxhash64.asm.ts | 131 ++++++++++++++++++++++++++++++++++ assembly/tsconfig.json | 6 ++ cspell.json | 2 + lib/util/createHash.js | 5 ++ lib/util/hash/xxhash64.js | 128 +++++++++++++++++++++++++++++++++ package.json | 8 ++- test/XxHash64.unittest.js | 69 ++++++++++++++++++ tooling/generate-wasm-code.js | 89 +++++++++++++++++++++++ yarn.lock | 23 ++++++ 10 files changed, 461 insertions(+), 2 deletions(-) create mode 100644 assembly/hash/xxhash64.asm.ts create mode 100644 assembly/tsconfig.json create mode 100644 lib/util/hash/xxhash64.js create mode 100644 test/XxHash64.unittest.js create mode 100644 tooling/generate-wasm-code.js diff --git a/.gitignore b/.gitignore index 5d5dd6ca211..5236a987751 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ /benchmark/js /benchmark/fixtures /examples/**/dist +/assembly/**/*.wat +/assembly/**/*.wasm /coverage /.nyc_output /.jest-cache diff --git a/assembly/hash/xxhash64.asm.ts b/assembly/hash/xxhash64.asm.ts new file mode 100644 index 00000000000..3525a77202f --- /dev/null +++ b/assembly/hash/xxhash64.asm.ts @@ -0,0 +1,131 @@ +// ////////////////////////////////////////////////////////// +// xxhash64.h +// Copyright (c) 2016 Stephan Brumme. All rights reserved. +// see http://create.stephan-brumme.com/disclaimer.html +// +// XXHash (64 bit), based on Yann Collet's descriptions, see +// http://cyan4973.github.io/xxHash/ +// +// Modified for hash-wasm by Dani Biró +// +// Ported to assemblyscript by Tobias Koppers +// Modifications: +// - seed is always 0 +// - update is only called with a multiple of 32 +// - final takes the remaining 0 - 31 bytes +// + +const Prime1: u64 = 11400714785074694791; +const Prime2: u64 = 14029467366897019727; +const Prime3: u64 = 1609587929392839161; +const Prime4: u64 = 9650029242287828579; +const Prime5: u64 = 2870177450012600261; + +let state0: u64; +let state1: u64; +let state2: u64; +let state3: u64; +let totalLength: u64; + +function processSingle(previous: u64, input: u64): u64 { + return rotl(previous + input * Prime2, 31) * Prime1; +} + +export function init(): void { + state0 = Prime1 + Prime2; + state1 = Prime2; + state2 = 0; + state3 = 0 - Prime1; + totalLength = 0; +} + +export function update(length: u32): void { + if (length == 0) return; + + totalLength += length; + + let dataPtr: u32 = 0; + + let s0 = state0; + let s1 = state1; + let s2 = state2; + let s3 = state3; + + do { + s0 = processSingle(s0, load(dataPtr)); + s1 = processSingle(s1, load(dataPtr + 8)); + s2 = processSingle(s2, load(dataPtr + 16)); + s3 = processSingle(s3, load(dataPtr + 24)); + dataPtr += 32; + } while (dataPtr < length); + + state0 = s0; + state1 = s1; + state2 = s2; + state3 = s3; +} + +export function final(length: u32): void { + // fold 256 bit state into one single 64 bit value + let result: u64; + if (totalLength > 0) { + result = + rotl(state0, 1) + rotl(state1, 7) + rotl(state2, 12) + rotl(state3, 18); + result = (result ^ processSingle(0, state0)) * Prime1 + Prime4; + result = (result ^ processSingle(0, state1)) * Prime1 + Prime4; + result = (result ^ processSingle(0, state2)) * Prime1 + Prime4; + result = (result ^ processSingle(0, state3)) * Prime1 + Prime4; + } else { + result = Prime5; + } + + result += totalLength + length; + + let dataPtr: u32 = 0; + + // at least 8 bytes left ? => eat 8 bytes per step + for (; dataPtr + 8 <= length; dataPtr += 8) { + result = + rotl(result ^ processSingle(0, load(dataPtr)), 27) * Prime1 + Prime4; + } + + // 4 bytes left ? => eat those + if (dataPtr + 4 <= length) { + result = rotl(result ^ (load(dataPtr) * Prime1), 23) * Prime2 + Prime3; + dataPtr += 4; + } + + // take care of remaining 0..3 bytes, eat 1 byte per step + while (dataPtr !== length) { + result = rotl(result ^ (load(dataPtr) * Prime5), 11) * Prime1; + dataPtr++; + } + + // mix bits + result ^= result >> 33; + result *= Prime2; + result ^= result >> 29; + result *= Prime3; + result ^= result >> 32; + + store(0, result); + + store(0, u32ToHex(result >> 32)); + store(8, u32ToHex(result & 0xffffffff)); +} + +function u32ToHex(x: u64): u64 { + // from https://johnnylee-sde.github.io/Fast-unsigned-integer-to-hex-string/ + + x = ((x & 0xffff) << 32) | ((x & 0xffff0000) >> 16); + x = ((x & 0x0000ff000000ff00) >> 8) | ((x & 0x000000ff000000ff) << 16); + x = ((x & 0x00f000f000f000f0) >> 4) | ((x & 0x000f000f000f000f) << 8); + + const mask = ((x + 0x0606060606060606) >> 4) & 0x0101010101010101; + + x |= 0x3030303030303030; + + x += 0x27 * mask; + + return x; +} diff --git a/assembly/tsconfig.json b/assembly/tsconfig.json new file mode 100644 index 00000000000..9cd498ea14e --- /dev/null +++ b/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "assemblyscript/std/assembly.json", + "include": [ + "./**/*.asm.ts" + ] +} diff --git a/cspell.json b/cspell.json index 7aa2415b99f..bf63b78ffbc 100644 --- a/cspell.json +++ b/cspell.json @@ -190,6 +190,7 @@ "hashbang", "webassemblyjs", + "assemblyscript", "fsevents", "watchpack", "tapable", @@ -201,6 +202,7 @@ "MCEP", "traceur", "atlaskit", + "xxhash", "xxhashjs", "systemjs", "skypack", diff --git a/lib/util/createHash.js b/lib/util/createHash.js index 81cfa0a221c..35528df75e1 100644 --- a/lib/util/createHash.js +++ b/lib/util/createHash.js @@ -125,6 +125,7 @@ class DebugHash extends Hash { } let crypto = undefined; +let createXXHash64 = undefined; /** * Creates a hash by name or function @@ -139,6 +140,10 @@ module.exports = algorithm => { // TODO add non-cryptographic algorithm here case "debug": return new DebugHash(); + case "xxhash64": + if (createXXHash64 === undefined) + createXXHash64 = require("./hash/xxhash64"); + return createXXHash64(); default: if (crypto === undefined) crypto = require("crypto"); return new BulkUpdateDecorator( diff --git a/lib/util/hash/xxhash64.js b/lib/util/hash/xxhash64.js new file mode 100644 index 00000000000..2d858875205 --- /dev/null +++ b/lib/util/hash/xxhash64.js @@ -0,0 +1,128 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 +const xxhash64 = new WebAssembly.Module( + Buffer.from( + // 1180 bytes + "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrwIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLsgYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEACfyACIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCECIAFBBGoLIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAiACQh2IhUL5893xmfaZqxZ+IgIgAkIgiIUiAjcDAEEAIAJCIIgiA0L//wODQiCGIANCgID8/w+DQhCIhCIDQv+BgIDwH4NCEIYgA0KA/oOAgOA/g0IIiIQiA0KPgLyA8IHAB4NCCIYgA0LwgcCHgJ6A+ACDQgSIhCIDQoaMmLDgwIGDBnxCBIhCgYKEiJCgwIABg0InfiADQrDgwIGDhoyYMIR8NwMAQQggAkL/////D4MiAkL//wODQiCGIAJCgID8/w+DQhCIhCICQv+BgIDwH4NCEIYgAkKA/oOAgOA/g0IIiIQiAkKPgLyA8IHAB4NCCIYgAkLwgcCHgJ6A+ACDQgSIhCICQoaMmLDgwIGDBnxCBIhCgYKEiJCgwIABg0InfiACQrDgwIGDhoyYMIR8NwMACw==", + "base64" + ) +); +//#endregion + +class XxHash64 { + /** + * @param {WebAssembly.Instance} instance wasm instance + */ + constructor(instance) { + const exports = /** @type {any} */ (instance.exports); + exports.init(); + this.instance = instance; + this.exports = exports; + this.mem = Buffer.from(exports.memory.buffer, 0, 65536); + this.buffered = 0; + } + + reset() { + this.buffered = 0; + this.exports.init(); + } + + /** + * @param {Buffer | string} data data + * @param {BufferEncoding=} encoding encoding + * @returns {this} itself + */ + update(data, encoding) { + if (typeof data === "string") { + if (data.length < 21845) { + this._updateWithShortString(data, encoding); + return this; + } else { + data = Buffer.from(data, encoding); + } + } + this._updateWithBuffer(data); + return this; + } + + /** + * @param {string} data data + * @param {BufferEncoding=} encoding encoding + * @returns {void} + */ + _updateWithShortString(data, encoding) { + const { exports, buffered, mem } = this; + const length = mem.write(data, buffered, encoding); + if (buffered + length < 32) { + this.buffered += length; + } else { + const l = ((buffered + length) >> 5) << 5; + exports.update(l); + const newBuffered = length + buffered - l; + this.buffered = newBuffered; + if (newBuffered > 0) mem.copyWithin(0, l, buffered + length); + } + } + + /** + * @param {Buffer} data data + * @returns {void} + */ + _updateWithBuffer(data) { + const { exports, buffered, mem } = this; + const length = data.length; + if (buffered + length < 32) { + data.copy(mem, buffered, 0, length); + this.buffered += length; + } else { + const l = ((buffered + length) >> 5) << 5; + if (l > 65536) { + let i = 65536 - buffered; + data.copy(mem, buffered, 0, i); + exports.update(65536); + const stop = l - buffered - 65536; + while (i < stop) { + data.copy(mem, 0, i, i + 65536); + exports.update(65536); + i += 65536; + } + data.copy(mem, 0, i, l - buffered); + exports.update(l - buffered - i); + } else { + data.copy(mem, buffered, 0, l - buffered); + exports.update(l); + } + const newBuffered = length + buffered - l; + this.buffered = newBuffered; + if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length); + } + } + + digest(type) { + const { exports, buffered, mem } = this; + exports.final(buffered); + Buffer.from(mem.buffer); + instancesPool.push(this); + return this.mem.toString("latin1", 0, 16); + } +} + +const instancesPool = []; + +const create = () => { + if (instancesPool.length > 0) { + const old = instancesPool.pop(); + old.reset(); + return old; + } else { + return new XxHash64(new WebAssembly.Instance(xxhash64)); + } +}; + +module.exports = create; diff --git a/package.json b/package.json index 3b9c1dba8fd..d9662dcdb74 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@types/es-module-lexer": "^0.4.1", "@types/jest": "^27.0.1", "@types/node": "^15.0.1", + "assemblyscript": "^0.19.16", "babel-loader": "^8.1.0", "benchmark": "^2.1.4", "bundle-loader": "^0.5.6", @@ -61,6 +62,7 @@ "eslint-plugin-prettier": "^4.0.0", "file-loader": "^6.0.0", "fork-ts-checker-webpack-plugin": "^6.0.5", + "hash-wasm": "^4.9.0", "husky": "^6.0.0", "is-ci": "^3.0.0", "istanbul": "^0.4.5", @@ -156,8 +158,8 @@ "type-lint": "tsc", "typings-lint": "tsc -p tsconfig.test.json", "spellcheck": "cspell \"{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}\" \"*.md\"", - "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals", - "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", + "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals", + "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix", "prepare": "husky install", "pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"", @@ -209,6 +211,8 @@ "/test/fixtures/temp-cache-fixture", "/test/fixtures/temp-", "/benchmark", + "/assembly", + "/tooling", "/examples/*/dist", "/coverage", "/.eslintcache" diff --git a/test/XxHash64.unittest.js b/test/XxHash64.unittest.js new file mode 100644 index 00000000000..4a75a0dd14a --- /dev/null +++ b/test/XxHash64.unittest.js @@ -0,0 +1,69 @@ +const createHash = require("../lib/util/hash/xxhash64"); +const { randomBytes } = require("crypto"); +const createReferenceHash = + require("hash-wasm/dist/xxhash64.umd.min.js").createXXHash64; + +describe("xxhash64", () => { + const sizes = [ + 1, + 2, + 3, + 4, + 5, + 7, + 8, + 9, + 16, + 31, + 32, + 33, + 64, + 100, + 1000, + 65536 - 1, + 65536, + 65536 + 1, + 65536 + 31, + 65536 * 5, + 65536 * 7 - 1, + 65536 * 9 + 31 + ]; + + const test = (name, sizes) => { + it(name + " should generate a hash from binary data", async () => { + const hash = createHash(); + const hashString = createHash(); + const reference = (await createReferenceHash()).init(); + for (const size of sizes) { + const bytes = randomBytes(size); + const string = bytes.toString("base64"); + hash.update(bytes); + hashString.update(string, "base64"); + reference.update(bytes); + } + const result = hash.digest("hex"); + expect(result).toMatch(/^[0-9a-f]{16}$/); + const resultFromString = hashString.digest("hex"); + expect(resultFromString).toMatch(/^[0-9a-f]{16}$/); + const expected = reference.digest("hex"); + expect(result).toBe(expected); + expect(resultFromString).toBe(expected); + }); + }; + + test("empty hash", []); + + for (const size of sizes) { + test(`single update ${size} bytes`, [size]); + } + + for (const size1 of sizes) { + for (const size2 of sizes) { + test(`two updates ${size1} + ${size2} bytes`, [size1, size2]); + } + } + test(`many updates 1`, sizes); + test(`many updates 2`, sizes.slice().reverse()); + test(`many updates 3`, sizes.concat(sizes.slice().reverse())); + test(`many updates 4`, sizes.slice().reverse().concat(sizes)); +}); diff --git a/tooling/generate-wasm-code.js b/tooling/generate-wasm-code.js new file mode 100644 index 00000000000..71ee020d379 --- /dev/null +++ b/tooling/generate-wasm-code.js @@ -0,0 +1,89 @@ +const path = require("path"); +const fs = require("fs"); +const asc = require("assemblyscript/cli/asc"); + +// When --write is set, files will be written in place +// Otherwise it only prints outdated files +const doWrite = process.argv.includes("--write"); + +const files = ["lib/util/hash/xxhash64.js"]; + +(async () => { + await asc.ready; + for (const file of files) { + const filePath = path.resolve(__dirname, "..", file); + const content = fs.readFileSync(filePath, "utf-8"); + + const regexp = + /\n\/\/#region wasm code: (.+) \((.+)\)(.*)\n[\s\S]+?\/\/#endregion\n/g; + + const replaces = new Map(); + + let match = regexp.exec(content); + while (match) { + const [fullMatch, identifier, name, flags] = match; + + const sourcePath = path.resolve(filePath, "..", name); + const sourcePathBase = path.join( + path.dirname(sourcePath), + path.basename(sourcePath) + ); + + await new Promise((resolve, reject) => { + asc.main( + [ + sourcePath, + // cspell:word Ospeed + "-Ospeed", + "--noAssert", + "--converge", + "--textFile", + sourcePathBase + ".wat", + "--binaryFile", + sourcePathBase + ".wasm", + ...flags.split(" ").filter(Boolean) + ], + { + stdout: process.stdout, + stderr: process.stderr + }, + err => { + if (err) return reject(err), 0; + resolve(); + return 0; + } + ); + }); + + const wasm = fs.readFileSync(sourcePathBase + ".wasm"); + + replaces.set( + fullMatch, + ` +//#region wasm code: ${identifier} (${name})${flags} +const ${identifier} = new WebAssembly.Module( + Buffer.from( + // ${wasm.length} bytes + ${JSON.stringify(wasm.toString("base64"))}, + "base64" + ) +); +//#endregion +` + ); + match = regexp.exec(content); + } + + const newContent = content.replace(regexp, match => replaces.get(match)); + + if (newContent !== content) { + if (doWrite) { + fs.writeFileSync(filePath, newContent, "utf-8"); + console.error(`${file} updated`); + } else { + console.error(`${file} need to be updated`); + process.exitCode = 1; + } + } + } +})(); diff --git a/yarn.lock b/yarn.lock index 1d72f9d9dd2..70c3e65bbda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1382,6 +1382,14 @@ asn1@~0.2.3: dependencies: safer-buffer "~2.1.0" +assemblyscript@^0.19.16: + version "0.19.16" + resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.19.16.tgz#fc06c9892755775e8e31a59249fbc361fd49e1d1" + integrity sha512-AMNdwcat+EEsxjkVQ5vOE/lDbXBvy1swQKAuMG2Ken+DZufZH7wKHIAVKR5liteW/jLL3T971l1MN+onP/bixA== + dependencies: + binaryen "101.0.0-nightly.20210904" + long "^4.0.0" + assert-never@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/assert-never/-/assert-never-1.2.1.tgz#11f0e363bf146205fb08193b5c7b90f4d1cf44fe" @@ -1530,6 +1538,11 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9" integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ== +binaryen@101.0.0-nightly.20210904: + version "101.0.0-nightly.20210904" + resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-101.0.0-nightly.20210904.tgz#58a7990d6d64b16567f376a1fe47d8aea6698b14" + integrity sha512-2AvJhErttuoMvgNcYPPpPy7C12PSvDdtZWtEeX/Otm/Vtf4ePvBpT3UIA00hGAh8HNaGr+dzFNstxTUvjNwZTg== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -3011,6 +3024,11 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +hash-wasm@^4.9.0: + version "4.9.0" + resolved "https://registry.yarnpkg.com/hash-wasm/-/hash-wasm-4.9.0.tgz#7e9dcc9f7d6bd0cc802f2a58f24edce999744206" + integrity sha512-7SW7ejyfnRxuOc7ptQHSf4LDoZaWOivfzqw+5rpcQku0nHfmicPKE51ra9BiRLAmT8+gGLestr1XroUkqdjL6w== + hasha@^5.0.0: version "5.2.2" resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.2.2.tgz#a48477989b3b327aea3c04f53096d816d97522a1" @@ -4189,6 +4207,11 @@ log-update@^4.0.0: slice-ansi "^4.0.0" wrap-ansi "^6.2.0" +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + loose-envify@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" From da8e93af330739c332670ed7d040a648431703b4 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 23 Sep 2021 15:04:22 +0200 Subject: [PATCH 14/34] use xxhash64 for future defaults --- lib/config/defaults.js | 9 ++++++--- test/Defaults.unittest.js | 29 ++++++++++++++++------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 283feffd3cf..4f30cf76661 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -190,7 +190,8 @@ const applyWebpackOptionsDefaults = options => { outputModule: options.experiments.outputModule, development, entry: options.entry, - module: options.module + module: options.module, + futureDefaults: options.experiments.futureDefaults }); applyExternalsPresetsDefaults(options.externalsPresets, { @@ -580,6 +581,7 @@ const applyModuleDefaults = ( * @param {boolean} options.development is development mode * @param {Entry} options.entry entry option * @param {ModuleOptions} options.module module option + * @param {boolean} options.futureDefaults is future defaults enabled * @returns {void} */ const applyOutputDefaults = ( @@ -591,7 +593,8 @@ const applyOutputDefaults = ( outputModule, development, entry, - module + module, + futureDefaults } ) => { /** @@ -788,7 +791,7 @@ const applyOutputDefaults = ( : "" ); D(output, "chunkLoadTimeout", 120000); - D(output, "hashFunction", "md4"); + D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4"); D(output, "hashDigest", "hex"); D(output, "hashDigestLength", 20); D(output, "strictModuleExceptionHandling", false); diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index d5df8388cb1..4df5e8df98a 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -1886,19 +1886,22 @@ Object { }, e => e.toMatchInlineSnapshot(` - - Expected - + Received +- Expected ++ Received - @@ ... @@ - - "futureDefaults": false, - + "futureDefaults": true, - @@ ... @@ - - "__dirname": "mock", - - "__filename": "mock", - - "global": true, - + "__dirname": "warn-mock", - + "__filename": "warn-mock", - + "global": "warn", - `) +@@ ... @@ +- "futureDefaults": false, ++ "futureDefaults": true, +@@ ... @@ +- "__dirname": "mock", +- "__filename": "mock", +- "global": true, ++ "__dirname": "warn-mock", ++ "__filename": "warn-mock", ++ "global": "warn", +@@ ... @@ +- "hashFunction": "md4", ++ "hashFunction": "xxhash64", +`) ); }); From 48157100764703fe8c19b240b2e1619e9494ecbf Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 23 Sep 2021 23:32:40 +0200 Subject: [PATCH 15/34] batch hashing --- lib/util/createHash.js | 9 +++-- lib/util/hash/BatchedHash.js | 65 ++++++++++++++++++++++++++++++++++++ lib/util/hash/xxhash64.js | 4 +-- 3 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 lib/util/hash/BatchedHash.js diff --git a/lib/util/createHash.js b/lib/util/createHash.js index 35528df75e1..bd8d2f0e2c9 100644 --- a/lib/util/createHash.js +++ b/lib/util/createHash.js @@ -126,6 +126,7 @@ class DebugHash extends Hash { let crypto = undefined; let createXXHash64 = undefined; +let BatchedHash = undefined; /** * Creates a hash by name or function @@ -141,9 +142,13 @@ module.exports = algorithm => { case "debug": return new DebugHash(); case "xxhash64": - if (createXXHash64 === undefined) + if (createXXHash64 === undefined) { createXXHash64 = require("./hash/xxhash64"); - return createXXHash64(); + if (BatchedHash === undefined) { + BatchedHash = require("./hash/BatchedHash"); + } + } + return new BatchedHash(createXXHash64()); default: if (crypto === undefined) crypto = require("crypto"); return new BulkUpdateDecorator( diff --git a/lib/util/hash/BatchedHash.js b/lib/util/hash/BatchedHash.js new file mode 100644 index 00000000000..e61fa790cfe --- /dev/null +++ b/lib/util/hash/BatchedHash.js @@ -0,0 +1,65 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const Hash = require("../Hash"); + +const MAX_STRING_LENGTH = 21845; + +class BatchedHash extends Hash { + constructor(hash) { + super(); + this.string = undefined; + this.encoding = undefined; + this.hash = hash; + } + + /** + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * @param {string|Buffer} data data + * @param {string=} inputEncoding data encoding + * @returns {this} updated hash + */ + update(data, inputEncoding) { + if (this.string !== undefined) { + if ( + typeof data === "string" && + inputEncoding === this.encoding && + this.string.length + data.length < MAX_STRING_LENGTH + ) { + this.string += data; + return this; + } + this.hash.update(this.string, this.encoding); + this.string = undefined; + } + if (typeof data === "string") { + if (data.length < MAX_STRING_LENGTH) { + this.string = data; + this.encoding = inputEncoding; + } else { + this.hash.update(data, inputEncoding); + } + } else { + this.hash.update(data); + } + return this; + } + + /** + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * @param {string=} encoding encoding of the return value + * @returns {string|Buffer} digest + */ + digest(encoding) { + if (this.string !== undefined) { + this.hash.update(this.string, this.encoding); + } + return this.hash.digest(encoding); + } +} + +module.exports = BatchedHash; diff --git a/lib/util/hash/xxhash64.js b/lib/util/hash/xxhash64.js index 2d858875205..40cd656e3a8 100644 --- a/lib/util/hash/xxhash64.js +++ b/lib/util/hash/xxhash64.js @@ -22,7 +22,6 @@ class XxHash64 { constructor(instance) { const exports = /** @type {any} */ (instance.exports); exports.init(); - this.instance = instance; this.exports = exports; this.mem = Buffer.from(exports.memory.buffer, 0, 65536); this.buffered = 0; @@ -107,9 +106,8 @@ class XxHash64 { digest(type) { const { exports, buffered, mem } = this; exports.final(buffered); - Buffer.from(mem.buffer); instancesPool.push(this); - return this.mem.toString("latin1", 0, 16); + return mem.toString("latin1", 0, 16); } } From d8b7c2a49fff5043fc7d33e6f69fc469af3661dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 02:14:00 +0000 Subject: [PATCH 16/34] chore(deps): bump enhanced-resolve from 5.8.2 to 5.8.3 Bumps [enhanced-resolve](https://github.com/webpack/enhanced-resolve) from 5.8.2 to 5.8.3. - [Release notes](https://github.com/webpack/enhanced-resolve/releases) - [Commits](https://github.com/webpack/enhanced-resolve/compare/v5.8.2...v5.8.3) --- updated-dependencies: - dependency-name: enhanced-resolve dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- yarn.lock | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/yarn.lock b/yarn.lock index c46afdcee38..1e277e3b22f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1551,15 +1551,15 @@ browser-process-hrtime@^1.0.0: integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== browserslist@^4.14.5, browserslist@^4.16.6: - version "4.16.8" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.8.tgz#cb868b0b554f137ba6e33de0ecff2eda403c4fb0" - integrity sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ== + version "4.17.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.17.1.tgz#a98d104f54af441290b7d592626dd541fa642eb9" + integrity sha512-aLD0ZMDSnF4lUt4ZDNgqi5BUn9BZ7YdQdI/cYlILrhdSSZJLU9aNZoD5/NBmM4SK34APB2e83MOsRt1EnkuyaQ== dependencies: - caniuse-lite "^1.0.30001251" - colorette "^1.3.0" - electron-to-chromium "^1.3.811" + caniuse-lite "^1.0.30001259" + electron-to-chromium "^1.3.846" escalade "^3.1.1" - node-releases "^1.1.75" + nanocolors "^0.1.5" + node-releases "^1.1.76" bser@2.1.1: version "2.1.1" @@ -1619,10 +1619,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -caniuse-lite@^1.0.30001251: - version "1.0.30001252" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001252.tgz#cb16e4e3dafe948fc4a9bb3307aea054b912019a" - integrity sha512-I56jhWDGMtdILQORdusxBOH+Nl/KgQSdDmpJezYddnAkVOmnoU8zwjTV9xAjMIYxr0iPreEAVylCGcmHCjfaOw== +caniuse-lite@^1.0.30001259: + version "1.0.30001259" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz#ae21691d3da9c4be6144403ac40f71d9f6efd790" + integrity sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg== caseless@~0.12.0: version "0.12.0" @@ -1794,7 +1794,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^1.2.1, colorette@^1.2.2, colorette@^1.3.0: +colorette@^1.2.1, colorette@^1.2.2: version "1.3.0" resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.3.0.tgz#ff45d2f0edb244069d3b772adeb04fed38d0a0af" integrity sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w== @@ -2213,10 +2213,10 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -electron-to-chromium@^1.3.811: - version "1.3.822" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.822.tgz#7036edc7f669b0aa79e9801dc5f56866c6ddc0b2" - integrity sha512-k7jG5oYYHxF4jx6PcqwHX3JVME/OjzolqOZiIogi9xtsfsmTjTdie4x88OakYFPEa8euciTgCCzvVNwvmjHb1Q== +electron-to-chromium@^1.3.846: + version "1.3.848" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.848.tgz#94cc196e496f33c0d71cd98561448f10018584cc" + integrity sha512-wchRyBcdcmibioggdO7CbMT5QQ4lXlN/g7Mkpf1K2zINidnqij6EVu94UIZ+h5nB2S9XD4bykqFv9LonAWLFyw== emittery@^0.8.1: version "0.8.1" @@ -2243,9 +2243,9 @@ enhanced-resolve@^4.0.0: tapable "^1.0.0" enhanced-resolve@^5.8.0: - version "5.8.2" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz#15ddc779345cbb73e97c611cd00c01c1e7bf4d8b" - integrity sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA== + version "5.8.3" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz#6d552d465cce0423f5b3d718511ea53826a7b2f0" + integrity sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -4399,6 +4399,11 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" +nanocolors@^0.1.5: + version "0.1.6" + resolved "https://registry.yarnpkg.com/nanocolors/-/nanocolors-0.1.6.tgz#bc2350d3edfdbfadd7ac018c855ae7c13905a6ad" + integrity sha512-2pvTw6vYRaBLGir2xR7MxaJtyWkrn+C53EpW8yPotG+pdAwBvt0Xwk4VJ6VHLY0aLthVZPvDfm9TdZvrvAm5UQ== + nanoid@^3.1.23: version "3.1.23" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81" @@ -4450,10 +4455,10 @@ node-preload@^0.2.1: dependencies: process-on-spawn "^1.0.0" -node-releases@^1.1.75: - version "1.1.75" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.75.tgz#6dd8c876b9897a1b8e5a02de26afa79bb54ebbfe" - integrity sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw== +node-releases@^1.1.76: + version "1.1.76" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.76.tgz#df245b062b0cafbd5282ab6792f7dccc2d97f36e" + integrity sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA== nopt@3.x: version "3.0.6" From 936ba06f2706d19924581b82cef2ac97ab750ba8 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 24 Sep 2021 09:19:43 +0200 Subject: [PATCH 17/34] faster utf-8 conversion for short strings --- lib/util/hash/xxhash64.js | 40 +++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/util/hash/xxhash64.js b/lib/util/hash/xxhash64.js index 40cd656e3a8..3bf2d3a30fc 100644 --- a/lib/util/hash/xxhash64.js +++ b/lib/util/hash/xxhash64.js @@ -57,15 +57,43 @@ class XxHash64 { */ _updateWithShortString(data, encoding) { const { exports, buffered, mem } = this; - const length = mem.write(data, buffered, encoding); - if (buffered + length < 32) { - this.buffered += length; + let endPos; + if (data.length < 70) { + if (!encoding || encoding === "utf-8" || encoding === "utf8") { + endPos = buffered; + for (let i = 0; i < data.length; i++) { + const cc = data.charCodeAt(i); + if (cc < 0x80) mem[endPos++] = cc; + else if (cc < 0x800) { + mem[endPos] = (cc >> 6) | 0xc0; + mem[endPos + 1] = (cc & 0x3f) | 0x80; + endPos += 2; + } else { + // bail-out for weird chars + endPos += mem.write(data.slice(endPos), endPos, encoding); + break; + } + } + } else if (encoding === "latin1") { + endPos = buffered; + for (let i = 0; i < data.length; i++) { + const cc = data.charCodeAt(i); + mem[endPos++] = cc; + } + } else { + endPos = buffered + mem.write(data, buffered, encoding); + } } else { - const l = ((buffered + length) >> 5) << 5; + endPos = buffered + mem.write(data, buffered, encoding); + } + if (endPos < 32) { + this.buffered = endPos; + } else { + const l = (endPos >> 5) << 5; exports.update(l); - const newBuffered = length + buffered - l; + const newBuffered = endPos - l; this.buffered = newBuffered; - if (newBuffered > 0) mem.copyWithin(0, l, buffered + length); + if (newBuffered > 0) mem.copyWithin(0, l, endPos); } } From 629ac95660b18dc71a835fc13c0573fed1cfe043 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 24 Sep 2021 14:32:26 +0200 Subject: [PATCH 18/34] write short strings more efficient to cache --- lib/serialization/BinaryMiddleware.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/serialization/BinaryMiddleware.js b/lib/serialization/BinaryMiddleware.js index a15771d0676..34326a06602 100644 --- a/lib/serialization/BinaryMiddleware.js +++ b/lib/serialization/BinaryMiddleware.js @@ -299,12 +299,21 @@ class BinaryMiddleware extends SerializerMiddleware { writeU8(STRING_HEADER); writeU32(len); currentBuffer.write(thing, currentPosition); - } else { + currentPosition += len; + } else if (len >= 70) { allocate(len + HEADER_SIZE); writeU8(SHORT_STRING_HEADER | len); + currentBuffer.write(thing, currentPosition, "latin1"); + currentPosition += len; + } else { + allocate(len + HEADER_SIZE); + writeU8(SHORT_STRING_HEADER | len); + + for (let i = 0; i < len; i++) { + currentBuffer[currentPosition++] = thing.charCodeAt(i); + } } - currentPosition += len; break; } case "number": { From 381614aecc02dffe6032201a628c5c107913c86a Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 24 Sep 2021 10:10:13 +0200 Subject: [PATCH 19/34] cache computation of values passed for hashing --- lib/AsyncDependenciesBlock.js | 11 +++- lib/dependencies/CachedConstDependency.js | 7 ++- lib/dependencies/ConstDependency.js | 16 +++-- lib/dependencies/JsonExportsDependency.js | 8 ++- lib/dependencies/ModuleDecoratorDependency.js | 7 ++- lib/dependencies/ProvidedDependency.js | 8 ++- lib/dependencies/PureExpressionDependency.js | 6 +- .../RuntimeRequirementsDependency.js | 6 +- .../StatsTestCases.basictest.js.snap | 60 +++++++++---------- 9 files changed, 83 insertions(+), 46 deletions(-) diff --git a/lib/AsyncDependenciesBlock.js b/lib/AsyncDependenciesBlock.js index d85b9b5e600..1794c86ab83 100644 --- a/lib/AsyncDependenciesBlock.js +++ b/lib/AsyncDependenciesBlock.js @@ -35,6 +35,7 @@ class AsyncDependenciesBlock extends DependenciesBlock { this.request = request; /** @type {DependenciesBlock} */ this.parent = undefined; + this._stringifiedGroupOptions = undefined; } /** @@ -49,7 +50,10 @@ class AsyncDependenciesBlock extends DependenciesBlock { * @returns {void} */ set chunkName(value) { - this.groupOptions.name = value; + if (this.groupOptions.name !== value) { + this.groupOptions.name = value; + this._stringifiedGroupOptions = undefined; + } } /** @@ -59,7 +63,10 @@ class AsyncDependenciesBlock extends DependenciesBlock { */ updateHash(hash, context) { const { chunkGraph } = context; - hash.update(JSON.stringify(this.groupOptions)); + if (this._stringifiedGroupOptions === undefined) { + this._stringifiedGroupOptions = JSON.stringify(this.groupOptions); + } + hash.update(this._stringifiedGroupOptions); const chunkGroup = chunkGraph.getBlockChunkGroup(this); hash.update(chunkGroup ? chunkGroup.id : ""); super.updateHash(hash, context); diff --git a/lib/dependencies/CachedConstDependency.js b/lib/dependencies/CachedConstDependency.js index 9d44954704e..1e07edeca20 100644 --- a/lib/dependencies/CachedConstDependency.js +++ b/lib/dependencies/CachedConstDependency.js @@ -27,6 +27,7 @@ class CachedConstDependency extends NullDependency { this.expression = expression; this.range = range; this.identifier = identifier; + this._hashUpdate = undefined; } /** @@ -36,9 +37,9 @@ class CachedConstDependency extends NullDependency { * @returns {void} */ updateHash(hash, context) { - hash.update(this.identifier + ""); - hash.update(this.range + ""); - hash.update(this.expression + ""); + if (this._hashUpdate === undefined) + this._hashUpdate = "" + this.identifier + this.range + this.expression; + hash.update(this._hashUpdate); } serialize(context) { diff --git a/lib/dependencies/ConstDependency.js b/lib/dependencies/ConstDependency.js index 60a8185cefc..72e2cab1577 100644 --- a/lib/dependencies/ConstDependency.js +++ b/lib/dependencies/ConstDependency.js @@ -30,6 +30,7 @@ class ConstDependency extends NullDependency { this.runtimeRequirements = runtimeRequirements ? new Set(runtimeRequirements) : null; + this._hashUpdate = undefined; } /** @@ -39,10 +40,17 @@ class ConstDependency extends NullDependency { * @returns {void} */ updateHash(hash, context) { - hash.update(this.range + ""); - hash.update(this.expression + ""); - if (this.runtimeRequirements) - hash.update(Array.from(this.runtimeRequirements).join() + ""); + if (this._hashUpdate === undefined) { + let hashUpdate = "" + this.range + "|" + this.expression; + if (this.runtimeRequirements) { + for (const item of this.runtimeRequirements) { + hashUpdate += "|"; + hashUpdate += item; + } + } + this._hashUpdate = hashUpdate; + } + hash.update(this._hashUpdate); } /** diff --git a/lib/dependencies/JsonExportsDependency.js b/lib/dependencies/JsonExportsDependency.js index fbaf9dbeb04..b8b90c2f71d 100644 --- a/lib/dependencies/JsonExportsDependency.js +++ b/lib/dependencies/JsonExportsDependency.js @@ -47,6 +47,7 @@ class JsonExportsDependency extends NullDependency { constructor(exports) { super(); this.exports = exports; + this._hashUpdate = undefined; } get type() { @@ -72,7 +73,12 @@ class JsonExportsDependency extends NullDependency { * @returns {void} */ updateHash(hash, context) { - hash.update(this.exports ? JSON.stringify(this.exports) : "undefined"); + if (this._hashUpdate === undefined) { + this._hashUpdate = this.exports + ? JSON.stringify(this.exports) + : "undefined"; + } + hash.update(this._hashUpdate); } serialize(context) { diff --git a/lib/dependencies/ModuleDecoratorDependency.js b/lib/dependencies/ModuleDecoratorDependency.js index cd0248437b3..0bf7fd255fc 100644 --- a/lib/dependencies/ModuleDecoratorDependency.js +++ b/lib/dependencies/ModuleDecoratorDependency.js @@ -30,6 +30,7 @@ class ModuleDecoratorDependency extends NullDependency { super(); this.decorator = decorator; this.allowExportsAccess = allowExportsAccess; + this._hashUpdate = undefined; } /** @@ -69,8 +70,10 @@ class ModuleDecoratorDependency extends NullDependency { * @returns {void} */ updateHash(hash, context) { - hash.update(this.decorator); - hash.update(`${this.allowExportsAccess}`); + if (this._hashUpdate === undefined) { + this._hashUpdate = `${this.decorator}${this.allowExportsAccess}`; + } + hash.update(this._hashUpdate); } serialize(context) { diff --git a/lib/dependencies/ProvidedDependency.js b/lib/dependencies/ProvidedDependency.js index 2362e3a0df9..0962ba76230 100644 --- a/lib/dependencies/ProvidedDependency.js +++ b/lib/dependencies/ProvidedDependency.js @@ -34,6 +34,7 @@ class ProvidedDependency extends ModuleDependency { this.identifier = identifier; this.path = path; this.range = range; + this._hashUpdate = undefined; } get type() { @@ -51,8 +52,11 @@ class ProvidedDependency extends ModuleDependency { * @returns {void} */ updateHash(hash, context) { - hash.update(this.identifier); - hash.update(this.path ? this.path.join(",") : "null"); + if (this._hashUpdate === undefined) { + this._hashUpdate = + this.identifier + (this.path ? this.path.join(",") : "null"); + } + hash.update(this._hashUpdate); } serialize(context) { diff --git a/lib/dependencies/PureExpressionDependency.js b/lib/dependencies/PureExpressionDependency.js index cea1834f5a2..3ee70286d1d 100644 --- a/lib/dependencies/PureExpressionDependency.js +++ b/lib/dependencies/PureExpressionDependency.js @@ -28,6 +28,7 @@ class PureExpressionDependency extends NullDependency { this.range = range; /** @type {Set | false} */ this.usedByExports = false; + this._hashUpdate = undefined; } /** @@ -37,7 +38,10 @@ class PureExpressionDependency extends NullDependency { * @returns {void} */ updateHash(hash, context) { - hash.update(this.range + ""); + if (this._hashUpdate === undefined) { + this._hashUpdate = this.range + ""; + } + hash.update(this._hashUpdate); } /** diff --git a/lib/dependencies/RuntimeRequirementsDependency.js b/lib/dependencies/RuntimeRequirementsDependency.js index ab4214a08e1..a64248e9f8d 100644 --- a/lib/dependencies/RuntimeRequirementsDependency.js +++ b/lib/dependencies/RuntimeRequirementsDependency.js @@ -23,6 +23,7 @@ class RuntimeRequirementsDependency extends NullDependency { constructor(runtimeRequirements) { super(); this.runtimeRequirements = new Set(runtimeRequirements); + this._hashUpdate = undefined; } /** @@ -32,7 +33,10 @@ class RuntimeRequirementsDependency extends NullDependency { * @returns {void} */ updateHash(hash, context) { - hash.update(Array.from(this.runtimeRequirements).join() + ""); + if (this._hashUpdate === undefined) { + this._hashUpdate = Array.from(this.runtimeRequirements).join() + ""; + } + hash.update(this._hashUpdate); } serialize(context) { diff --git a/test/__snapshots__/StatsTestCases.basictest.js.snap b/test/__snapshots__/StatsTestCases.basictest.js.snap index 9f04636053a..8a94c7ed304 100644 --- a/test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/test/__snapshots__/StatsTestCases.basictest.js.snap @@ -658,9 +658,9 @@ webpack x.x.x compiled successfully in X ms" `; exports[`StatsTestCases should print correct stats for commons-plugin-issue-4980 1`] = ` -"asset app.4048a647fe3452d6c6b7-1.js 6.24 KiB [emitted] [immutable] (name: app) +"asset app.cf6134c86a3764bf5541-1.js 6.24 KiB [emitted] [immutable] (name: app) asset vendor.ebb9b6c7e5493f36bead-1.js 619 bytes [emitted] [immutable] (name: vendor) (id hint: vendor) -Entrypoint app 6.84 KiB = vendor.ebb9b6c7e5493f36bead-1.js 619 bytes app.4048a647fe3452d6c6b7-1.js 6.24 KiB +Entrypoint app 6.84 KiB = vendor.ebb9b6c7e5493f36bead-1.js 619 bytes app.cf6134c86a3764bf5541-1.js 6.24 KiB runtime modules 2.76 KiB 4 modules orphan modules 118 bytes [orphan] 2 modules cacheable modules 272 bytes @@ -668,9 +668,9 @@ cacheable modules 272 bytes ./constants.js 87 bytes [built] [code generated] webpack x.x.x compiled successfully in X ms -asset app.e1acc68ab0b33c974bd6-2.js 6.26 KiB [emitted] [immutable] (name: app) +asset app.089a6b1a54e28aecba11-2.js 6.26 KiB [emitted] [immutable] (name: app) asset vendor.ebb9b6c7e5493f36bead-2.js 619 bytes [emitted] [immutable] (name: vendor) (id hint: vendor) -Entrypoint app 6.86 KiB = vendor.ebb9b6c7e5493f36bead-2.js 619 bytes app.e1acc68ab0b33c974bd6-2.js 6.26 KiB +Entrypoint app 6.86 KiB = vendor.ebb9b6c7e5493f36bead-2.js 619 bytes app.089a6b1a54e28aecba11-2.js 6.26 KiB runtime modules 2.76 KiB 4 modules orphan modules 125 bytes [orphan] 2 modules cacheable modules 279 bytes @@ -700,10 +700,10 @@ exports[`StatsTestCases should print correct stats for concat-and-sideeffects 1` `; exports[`StatsTestCases should print correct stats for context-independence 1`] = ` -"asset main-0bba425408895d66edc2.js 10.4 KiB [emitted] [immutable] (name: main) - sourceMap main-0bba425408895d66edc2.js.map 9.27 KiB [emitted] [dev] (auxiliary name: main) -asset 695-996cbcc94c36e62bcba0.js 455 bytes [emitted] [immutable] - sourceMap 695-996cbcc94c36e62bcba0.js.map 342 bytes [emitted] [dev] +"asset main-5247897288595e4776a8.js 10.4 KiB [emitted] [immutable] (name: main) + sourceMap main-5247897288595e4776a8.js.map 9.27 KiB [emitted] [dev] (auxiliary name: main) +asset 695-c2bff00f4dc67a034047.js 455 bytes [emitted] [immutable] + sourceMap 695-c2bff00f4dc67a034047.js.map 342 bytes [emitted] [dev] runtime modules 6.3 KiB 8 modules orphan modules 19 bytes [orphan] 1 module cacheable modules 106 bytes @@ -711,10 +711,10 @@ cacheable modules 106 bytes ./a/chunk.js + 1 modules (in Xdir/context-independence/a) 66 bytes [built] [code generated] webpack x.x.x compiled successfully in X ms -asset main-0bba425408895d66edc2.js 10.4 KiB [emitted] [immutable] (name: main) - sourceMap main-0bba425408895d66edc2.js.map 9.27 KiB [emitted] [dev] (auxiliary name: main) -asset 695-996cbcc94c36e62bcba0.js 455 bytes [emitted] [immutable] - sourceMap 695-996cbcc94c36e62bcba0.js.map 342 bytes [emitted] [dev] +asset main-5247897288595e4776a8.js 10.4 KiB [emitted] [immutable] (name: main) + sourceMap main-5247897288595e4776a8.js.map 9.27 KiB [emitted] [dev] (auxiliary name: main) +asset 695-c2bff00f4dc67a034047.js 455 bytes [emitted] [immutable] + sourceMap 695-c2bff00f4dc67a034047.js.map 342 bytes [emitted] [dev] runtime modules 6.3 KiB 8 modules orphan modules 19 bytes [orphan] 1 module cacheable modules 106 bytes @@ -722,8 +722,8 @@ cacheable modules 106 bytes ./b/chunk.js + 1 modules (in Xdir/context-independence/b) 66 bytes [built] [code generated] webpack x.x.x compiled successfully in X ms -asset main-feace509aa3ce367cc19.js 11.6 KiB [emitted] [immutable] (name: main) -asset 695-dd77aceb318649b4e959.js 1.5 KiB [emitted] [immutable] +asset main-7db72914ff1feab68bcc.js 11.6 KiB [emitted] [immutable] (name: main) +asset 695-853aed631cbe225eb67f.js 1.5 KiB [emitted] [immutable] runtime modules 6.3 KiB 8 modules orphan modules 19 bytes [orphan] 1 module cacheable modules 106 bytes @@ -731,8 +731,8 @@ cacheable modules 106 bytes ./a/chunk.js + 1 modules (in Xdir/context-independence/a) 66 bytes [built] [code generated] webpack x.x.x compiled successfully in X ms -asset main-feace509aa3ce367cc19.js 11.6 KiB [emitted] [immutable] (name: main) -asset 695-dd77aceb318649b4e959.js 1.5 KiB [emitted] [immutable] +asset main-7db72914ff1feab68bcc.js 11.6 KiB [emitted] [immutable] (name: main) +asset 695-853aed631cbe225eb67f.js 1.5 KiB [emitted] [immutable] runtime modules 6.3 KiB 8 modules orphan modules 19 bytes [orphan] 1 module cacheable modules 106 bytes @@ -740,8 +740,8 @@ cacheable modules 106 bytes ./b/chunk.js + 1 modules (in Xdir/context-independence/b) 66 bytes [built] [code generated] webpack x.x.x compiled successfully in X ms -asset main-ff2341c939081a4317cb.js 11.3 KiB [emitted] [immutable] (name: main) -asset 695-bd48ae52e02841adf5e6.js 1.01 KiB [emitted] [immutable] +asset main-f86a1a4e2fa0a24cd00a.js 11.3 KiB [emitted] [immutable] (name: main) +asset 695-c98ab195b6c00d1ace5b.js 1.01 KiB [emitted] [immutable] runtime modules 6.3 KiB 8 modules orphan modules 19 bytes [orphan] 1 module cacheable modules 106 bytes @@ -749,8 +749,8 @@ cacheable modules 106 bytes ./a/chunk.js + 1 modules (in Xdir/context-independence/a) 66 bytes [built] [code generated] webpack x.x.x compiled successfully in X ms -asset main-ff2341c939081a4317cb.js 11.3 KiB [emitted] [immutable] (name: main) -asset 695-bd48ae52e02841adf5e6.js 1.01 KiB [emitted] [immutable] +asset main-f86a1a4e2fa0a24cd00a.js 11.3 KiB [emitted] [immutable] (name: main) +asset 695-c98ab195b6c00d1ace5b.js 1.01 KiB [emitted] [immutable] runtime modules 6.3 KiB 8 modules orphan modules 19 bytes [orphan] 1 module cacheable modules 106 bytes @@ -1144,10 +1144,10 @@ runtime modules 2.47 KiB 3 modules webpack x.x.x compiled successfully in X ms asset b-runtime~main-54fb57393ddb58c14c12.js 5.86 KiB [emitted] [immutable] (name: runtime~main) -asset b-all-b_js-d09f99e25781be397e6c.js 475 bytes [emitted] [immutable] (id hint: all) +asset b-all-b_js-937030672c8a31cdd3e9.js 475 bytes [emitted] [immutable] (id hint: all) asset b-main-132fd6da6e6e6728c990.js 438 bytes [emitted] [immutable] (name: main) asset b-vendors-node_modules_vendor_js-499179597d8c965dd5e0.js 185 bytes [emitted] [immutable] (id hint: vendors) -Entrypoint main 6.93 KiB = b-runtime~main-54fb57393ddb58c14c12.js 5.86 KiB b-vendors-node_modules_vendor_js-499179597d8c965dd5e0.js 185 bytes b-all-b_js-d09f99e25781be397e6c.js 475 bytes b-main-132fd6da6e6e6728c990.js 438 bytes +Entrypoint main 6.93 KiB = b-runtime~main-54fb57393ddb58c14c12.js 5.86 KiB b-vendors-node_modules_vendor_js-499179597d8c965dd5e0.js 185 bytes b-all-b_js-937030672c8a31cdd3e9.js 475 bytes b-main-132fd6da6e6e6728c990.js 438 bytes runtime modules 3.03 KiB 5 modules cacheable modules 40 bytes ./b.js 17 bytes [built] [code generated] @@ -1155,12 +1155,12 @@ cacheable modules 40 bytes webpack x.x.x compiled successfully in X ms assets by chunk 895 bytes (id hint: all) - asset c-all-b_js-3c3d3ae5b364fadfafb2.js 502 bytes [emitted] [immutable] (id hint: all) + asset c-all-b_js-db80d48a68188f12c60f.js 502 bytes [emitted] [immutable] (id hint: all) asset c-all-c_js-5a3e032792662f68ffa4.js 393 bytes [emitted] [immutable] (id hint: all) -asset c-runtime~main-2b89fbb33ebb9be1d93a.js 13.6 KiB [emitted] [immutable] (name: runtime~main) +asset c-runtime~main-0f5e3c54060a84caba03.js 13.6 KiB [emitted] [immutable] (name: runtime~main) asset c-main-67570433584a09b646bc.js 680 bytes [emitted] [immutable] (name: main) asset c-vendors-node_modules_vendor_js-499179597d8c965dd5e0.js 185 bytes [emitted] [immutable] (id hint: vendors) -Entrypoint main 14.6 KiB = c-runtime~main-2b89fbb33ebb9be1d93a.js 13.6 KiB c-all-c_js-5a3e032792662f68ffa4.js 393 bytes c-main-67570433584a09b646bc.js 680 bytes +Entrypoint main 14.6 KiB = c-runtime~main-0f5e3c54060a84caba03.js 13.6 KiB c-all-c_js-5a3e032792662f68ffa4.js 393 bytes c-main-67570433584a09b646bc.js 680 bytes runtime modules 8.67 KiB 13 modules cacheable modules 101 bytes ./c.js 61 bytes [built] [code generated] @@ -2459,7 +2459,7 @@ LOG from webpack.FileSystemInfo exports[`StatsTestCases should print correct stats for real-content-hash 1`] = ` "a-normal: assets by path *.js 3.23 KiB - asset e1e88dc9cfc1b47c4954-e1e88d.js 2.75 KiB [emitted] [immutable] [minimized] (name: runtime) + asset 72965507c7b4c0b4fc29-729655.js 2.75 KiB [emitted] [immutable] [minimized] (name: runtime) asset a6d438a0676f93383d79-a6d438.js 262 bytes [emitted] [immutable] [minimized] (name: lazy) asset cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes [emitted] [immutable] [minimized] (name: index) asset 666f2b8847021ccc7608-666f2b.js 21 bytes [emitted] [immutable] [minimized] (name: a, b) @@ -2467,7 +2467,7 @@ exports[`StatsTestCases should print correct stats for real-content-hash 1`] = ` asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index) - Entrypoint index 2.96 KiB (5.89 KiB) = e1e88dc9cfc1b47c4954-e1e88d.js 2.75 KiB cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes 1 auxiliary asset + Entrypoint index 2.96 KiB (5.89 KiB) = 72965507c7b4c0b4fc29-729655.js 2.75 KiB cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes 1 auxiliary asset Entrypoint a 21 bytes = 666f2b8847021ccc7608-666f2b.js Entrypoint b 21 bytes = 666f2b8847021ccc7608-666f2b.js runtime modules 7.29 KiB 9 modules @@ -2544,8 +2544,8 @@ a-source-map: b-source-map: assets by path *.js 3.45 KiB - asset 338f50bd5a2d2dac263f-338f50.js 2.81 KiB [emitted] [immutable] [minimized] (name: runtime) - sourceMap 338f50bd5a2d2dac263f-338f50.js.map 14.5 KiB [emitted] [dev] (auxiliary name: runtime) + asset d618b31bb631bdbaee8e-d618b3.js 2.81 KiB [emitted] [immutable] [minimized] (name: runtime) + sourceMap d618b31bb631bdbaee8e-d618b3.js.map 14.5 KiB [emitted] [dev] (auxiliary name: runtime) asset da6ceedb86c86e79a49a-da6cee.js 318 bytes [emitted] [immutable] [minimized] (name: lazy) sourceMap da6ceedb86c86e79a49a-da6cee.js.map 397 bytes [emitted] [dev] (auxiliary name: lazy) asset 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes [emitted] [immutable] [minimized] (name: index) @@ -2556,7 +2556,7 @@ b-source-map: asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy) asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index) - Entrypoint index 3.07 KiB (20.7 KiB) = 338f50bd5a2d2dac263f-338f50.js 2.81 KiB 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes 3 auxiliary assets + Entrypoint index 3.07 KiB (20.7 KiB) = d618b31bb631bdbaee8e-d618b3.js 2.81 KiB 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes 3 auxiliary assets Entrypoint a 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset Entrypoint b 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset runtime modules 7.29 KiB 9 modules From 3b48429eb564061c29d38c15579e00b4c48f13a7 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 24 Sep 2021 11:35:28 +0200 Subject: [PATCH 20/34] add MemCache for memory caching per module which is invalidated when module or any referenced modules changes add `experiments.cacheUnaffected` add `cache.cacheUnaffected` (type: memory) resp `cache.memoryCacheUnaffected` (type: filesystem) --- declarations/WebpackOptions.d.ts | 12 + lib/ChunkGraph.js | 17 +- lib/Compilation.js | 202 ++++++++++++++- lib/Compiler.js | 4 + lib/FlagDependencyExportsPlugin.js | 59 +++-- lib/MemCache.js | 45 ++++ lib/WebpackOptionsApply.js | 16 ++ lib/config/defaults.js | 16 +- schemas/WebpackOptions.check.js | 2 +- schemas/WebpackOptions.json | 12 + test/Defaults.unittest.js | 244 +++++++++--------- test/__snapshots__/Cli.test.js.snap | 39 +++ .../StatsTestCases.basictest.js.snap | 32 ++- .../cache/add-defines/webpack.config.js | 3 +- types.d.ts | 28 +- 15 files changed, 559 insertions(+), 172 deletions(-) create mode 100644 lib/MemCache.js diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index f43a46b1d51..5f510f63736 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -880,6 +880,10 @@ export interface WebpackOptions { * Options object for in-memory caching. */ export interface MemoryCacheOptions { + /** + * Additionally cache computation of modules that are unchanged and reference only unchanged modules. + */ + cacheUnaffected?: boolean; /** * Number of generations unused cache entries stay in memory cache at minimum (1 = may be removed after unused for a single compilation, ..., Infinity: kept forever). */ @@ -950,6 +954,10 @@ export interface FileCacheOptions { * Number of generations unused cache entries stay in memory cache at minimum (0 = no memory cache used, 1 = may be removed after unused for a single compilation, ..., Infinity: kept forever). Cache entries will be deserialized from disk when removed from memory cache. */ maxMemoryGenerations?: number; + /** + * Additionally cache computation of modules that are unchanged and reference only unchanged modules in memory. + */ + memoryCacheUnaffected?: boolean; /** * Name for the cache. Different names will lead to different coexisting caches. */ @@ -1106,6 +1114,10 @@ export interface Experiments { * Build http(s): urls using a lockfile and resource content cache. */ buildHttp?: boolean | HttpUriOptions; + /** + * Enable additional in memory caching of modules that are unchanged and reference only unchanged modules. + */ + cacheUnaffected?: boolean; /** * Apply defaults of next major version. */ diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index 24e0a817925..15eadc358dc 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -1376,22 +1376,29 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza /** * @param {Module} module the module * @param {RuntimeSpec} runtime the runtime - * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph) + * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph when transferOwnership not false) + * @param {boolean} transferOwnership true: transfer ownership of the items object, false: items is immutable and shared and won't be modified * @returns {void} */ - addModuleRuntimeRequirements(module, runtime, items) { + addModuleRuntimeRequirements( + module, + runtime, + items, + transferOwnership = true + ) { const cgm = this._getChunkGraphModule(module); const runtimeRequirementsMap = cgm.runtimeRequirements; if (runtimeRequirementsMap === undefined) { const map = new RuntimeSpecMap(); - map.set(runtime, items); + // TODO avoid cloning item and track ownership instead + map.set(runtime, transferOwnership ? items : new Set(items)); cgm.runtimeRequirements = map; return; } runtimeRequirementsMap.update(runtime, runtimeRequirements => { if (runtimeRequirements === undefined) { - return items; - } else if (runtimeRequirements.size >= items.size) { + return transferOwnership ? items : new Set(items); + } else if (!transferOwnership || runtimeRequirements.size >= items.size) { for (const item of items) runtimeRequirements.add(item); return runtimeRequirements; } else { diff --git a/lib/Compilation.js b/lib/Compilation.js index 8529818d898..d8846b966c0 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -38,6 +38,7 @@ const { tryRunOrWebpackError } = require("./HookWebpackError"); const MainTemplate = require("./MainTemplate"); +const MemCache = require("./MemCache"); const Module = require("./Module"); const ModuleDependencyError = require("./ModuleDependencyError"); const ModuleDependencyWarning = require("./ModuleDependencyWarning"); @@ -76,7 +77,7 @@ const { createFakeHook } = require("./util/deprecation"); const processAsyncTree = require("./util/processAsyncTree"); -const { getRuntimeKey } = require("./util/runtime"); +const { getRuntimeKey, RuntimeSpecMap } = require("./util/runtime"); const { isSourceEqual } = require("./util/source"); /** @template T @typedef {import("tapable").AsArray} AsArray */ @@ -892,6 +893,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }; defineRemovedModuleTemplates(this.moduleTemplates); + /** @type {MemCache | undefined} */ + this.memCache = undefined; + /** @type {WeakMap | undefined} */ + this.moduleMemCaches = undefined; this.moduleGraph = new ModuleGraph(); /** @type {ChunkGraph} */ this.chunkGraph = undefined; @@ -2012,6 +2017,79 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }); } + _computeAffectedModules(modules) { + const moduleMemCacheCache = this.compiler.moduleMemCaches; + if (!moduleMemCacheCache) return; + if (!this.moduleMemCaches) this.moduleMemCaches = new WeakMap(); + if (!this.memCache) this.memCache = new MemCache(); + const { moduleGraph, memCache, moduleMemCaches } = this; + const affectedModules = new Set(); + const infectedModules = new Set(); + let statNew = 0; + let statChanged = 0; + let statUnchanged = 0; + let statWithoutHash = 0; + for (const module of modules) { + const hash = module.buildInfo && module.buildInfo.hash; + if (typeof hash === "string") { + const cachedMemCache = moduleMemCacheCache.get(module); + if (cachedMemCache === undefined) { + // create a new entry + moduleMemCacheCache.set(module, { + hash: hash, + memCache + }); + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + statNew++; + } else if (cachedMemCache.hash === hash) { + // keep the old mem cache + moduleMemCaches.set(module, cachedMemCache.memCache); + statUnchanged++; + } else { + // use a new one + moduleMemCaches.set(module, memCache); + affectedModules.add(module); + cachedMemCache.hash = hash; + cachedMemCache.memCache = memCache; + statChanged++; + } + } else { + infectedModules.add(module); + statWithoutHash++; + } + } + for (const module of infectedModules) { + for (const referencingModule of moduleGraph + .getIncomingConnectionsByOriginModule(module) + .keys()) { + if (infectedModules.has(referencingModule)) continue; + infectedModules.add(referencingModule); + } + } + for (const module of affectedModules) { + for (const referencingModule of moduleGraph + .getIncomingConnectionsByOriginModule(module) + .keys()) { + if (!referencingModule) continue; + if (infectedModules.has(referencingModule)) continue; + if (affectedModules.has(referencingModule)) continue; + affectedModules.add(referencingModule); + moduleMemCaches.set(referencingModule, memCache); + } + } + this.logger.log( + `${Math.round( + (100 * (affectedModules.size + infectedModules.size)) / + this.modules.size + )}% (${affectedModules.size} affected + ${ + infectedModules.size + } infected of ${ + this.modules.size + }) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statUnchanged} unchanged, ${statWithoutHash} without hash)` + ); + } + finish(callback) { this.factorizeQueue.clear(); if (this.profile) { @@ -2192,17 +2270,29 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si ); this.logger.timeEnd("finish module profiles"); } + this.logger.time("compute affected modules"); + this._computeAffectedModules(this.modules); + this.logger.timeEnd("compute affected modules"); this.logger.time("finish modules"); - const { modules } = this; + const { modules, moduleMemCaches } = this; this.hooks.finishModules.callAsync(modules, err => { this.logger.timeEnd("finish modules"); if (err) return callback(err); // extract warnings and errors from modules - this.logger.time("report dependency errors and warnings"); this.moduleGraph.freeze(); + // TODO keep a cacheToken (= {}) for each module in the graph + // create a new one per compilation and flag all updated files + // and parents with it + this.logger.time("report dependency errors and warnings"); for (const module of modules) { - this.reportDependencyErrorsAndWarnings(module, [module]); + // TODO only run for modules with changed cacheToken + // global WeakMap> to keep modules without errors/warnings + const memCache = moduleMemCaches && moduleMemCaches.get(module); + if (memCache && memCache.get(module, "noWarningsOrErrors")) continue; + let hasProblems = this.reportDependencyErrorsAndWarnings(module, [ + module + ]); const errors = module.getErrors(); if (errors !== undefined) { for (const error of errors) { @@ -2210,6 +2300,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si error.module = module; } this.errors.push(error); + hasProblems = true; } } const warnings = module.getWarnings(); @@ -2219,8 +2310,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si warning.module = module; } this.warnings.push(warning); + hasProblems = true; } } + if (!hasProblems && memCache) + memCache.set(module, "noWarningsOrErrors", true); } this.moduleGraph.unfreeze(); this.logger.timeEnd("report dependency errors and warnings"); @@ -2577,9 +2671,10 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o /** * @param {Module} module module to report from * @param {DependenciesBlock[]} blocks blocks to report from - * @returns {void} + * @returns {boolean} true, when it has warnings or errors */ reportDependencyErrorsAndWarnings(module, blocks) { + let hasProblems = false; for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) { const block = blocks[indexBlock]; const dependencies = block.dependencies; @@ -2594,6 +2689,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o const warning = new ModuleDependencyWarning(module, w, d.loc); this.warnings.push(warning); + hasProblems = true; } } const errors = d.getErrors(this.moduleGraph); @@ -2603,12 +2699,15 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o const error = new ModuleDependencyError(module, e, d.loc); this.errors.push(error); + hasProblems = true; } } } - this.reportDependencyErrorsAndWarnings(module, block.blocks); + if (this.reportDependencyErrorsAndWarnings(module, block.blocks)) + hasProblems = true; } + return hasProblems; } codeGeneration(callback) { @@ -2796,12 +2895,41 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o chunkGraphEntries = this._getChunkGraphEntries() } = {}) { const context = { chunkGraph, codeGenerationResults }; + const { moduleMemCaches } = this; + this.logger.time("runtime requirements.modules"); const additionalModuleRuntimeRequirements = this.hooks.additionalModuleRuntimeRequirements; const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule; for (const module of modules) { if (chunkGraph.getNumberOfModuleChunks(module) > 0) { + const memCache = + moduleMemCaches && + // modules with async blocks depend on the chunk graph and can't be cached that way + module.blocks.length === 0 && + moduleMemCaches.get(module); + /** @type {RuntimeSpecMap>} */ + const moduleRuntimeRequirementsMemCache = + memCache && + memCache.provide( + module, + "moduleRuntimeRequirements", + () => new RuntimeSpecMap() + ); for (const runtime of chunkGraph.getModuleRuntimes(module)) { + if (moduleRuntimeRequirementsMemCache) { + const cached = moduleRuntimeRequirementsMemCache.get(runtime); + if (cached !== undefined) { + if (cached !== null) { + chunkGraph.addModuleRuntimeRequirements( + module, + runtime, + cached, + false + ); + } + continue; + } + } let set; const runtimeRequirements = codeGenerationResults.getRuntimeRequirements(module, runtime); @@ -2810,6 +2938,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } else if (additionalModuleRuntimeRequirements.isUsed()) { set = new Set(); } else { + if (moduleRuntimeRequirementsMemCache) { + moduleRuntimeRequirementsMemCache.set(runtime, null); + } continue; } additionalModuleRuntimeRequirements.call(module, set, context); @@ -2818,11 +2949,29 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o const hook = runtimeRequirementInModule.get(r); if (hook !== undefined) hook.call(module, set, context); } - chunkGraph.addModuleRuntimeRequirements(module, runtime, set); + if (set.size === 0) { + if (moduleRuntimeRequirementsMemCache) { + moduleRuntimeRequirementsMemCache.set(runtime, null); + } + } else { + if (moduleRuntimeRequirementsMemCache) { + moduleRuntimeRequirementsMemCache.set(runtime, set); + chunkGraph.addModuleRuntimeRequirements( + module, + runtime, + set, + false + ); + } else { + chunkGraph.addModuleRuntimeRequirements(module, runtime, set); + } + } } } } + this.logger.timeEnd("runtime requirements.modules"); + this.logger.time("runtime requirements.chunks"); for (const chunk of chunks) { const set = new Set(); for (const module of chunkGraph.getChunkModulesIterable(chunk)) { @@ -2840,7 +2989,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o chunkGraph.addChunkRuntimeRequirements(chunk, set); } + this.logger.timeEnd("runtime requirements.chunks"); + this.logger.time("runtime requirements.entries"); for (const treeEntry of chunkGraphEntries) { const set = new Set(); for (const chunk of treeEntry.getAllReferencedChunks()) { @@ -2863,6 +3014,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o chunkGraph.addTreeRuntimeRequirements(treeEntry, set); } + this.logger.timeEnd("runtime requirements.entries"); } // TODO webpack 6 make chunkGraph argument non-optional @@ -3207,12 +3359,35 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o createModuleHashes() { let statModulesHashed = 0; - const { chunkGraph, runtimeTemplate } = this; + let statModulesFromCache = 0; + const { chunkGraph, runtimeTemplate, moduleMemCaches } = this; const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions; for (const module of this.modules) { + const memCache = + moduleMemCaches && + // modules with async blocks depend on the chunk graph and can't be cached that way + module.blocks.length === 0 && + moduleMemCaches.get(module); + /** @type {RuntimeSpecMap} */ + const moduleHashesMemCache = + memCache && + memCache.provide(module, "moduleHashes", () => new RuntimeSpecMap()); for (const runtime of chunkGraph.getModuleRuntimes(module)) { + if (moduleHashesMemCache) { + const digest = moduleHashesMemCache.get(runtime); + if (digest !== undefined) { + chunkGraph.setModuleHashes( + module, + runtime, + digest, + digest.substr(0, hashDigestLength) + ); + statModulesFromCache++; + continue; + } + } statModulesHashed++; - this._createModuleHash( + const digest = this._createModuleHash( module, chunkGraph, runtime, @@ -3221,11 +3396,16 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o hashDigest, hashDigestLength ); + if (moduleHashesMemCache) { + moduleHashesMemCache.set(runtime, digest); + } } } this.logger.log( - `${statModulesHashed} modules hashed (${ - Math.round((100 * statModulesHashed) / this.modules.size) / 100 + `${statModulesHashed} modules hashed, ${statModulesFromCache} from cache (${ + Math.round( + (100 * (statModulesHashed + statModulesFromCache)) / this.modules.size + ) / 100 } variants per module in average)` ); } diff --git a/lib/Compiler.js b/lib/Compiler.js index bf30373708b..f5d1d3039ee 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -41,6 +41,7 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ /** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ +/** @typedef {import("./MemCache")} MemCache */ /** @typedef {import("./Module")} Module */ /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ @@ -247,6 +248,9 @@ class Compiler { this.cache = new Cache(); + /** @type {WeakMap | undefined} */ + this.moduleMemCaches = undefined; + this.compilerPath = ""; /** @type {boolean} */ diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js index b0d9643ef0a..b98b222e260 100644 --- a/lib/FlagDependencyExportsPlugin.js +++ b/lib/FlagDependencyExportsPlugin.js @@ -28,12 +28,14 @@ class FlagDependencyExportsPlugin { compilation => { const moduleGraph = compilation.moduleGraph; const cache = compilation.getCache("FlagDependencyExportsPlugin"); + const { moduleMemCaches } = compilation; compilation.hooks.finishModules.tapAsync( "FlagDependencyExportsPlugin", (modules, callback) => { const logger = compilation.getLogger( "webpack.FlagDependencyExportsPlugin" ); + let statRestoredFromMemCache = 0; let statRestoredFromCache = 0; let statNoExports = 0; let statFlaggedUncached = 0; @@ -58,16 +60,22 @@ class FlagDependencyExportsPlugin { return callback(); } } - if ( - module.buildInfo.cacheable !== true || - typeof module.buildInfo.hash !== "string" - ) { + if (typeof module.buildInfo.hash !== "string") { statFlaggedUncached++; // Enqueue uncacheable module for determining the exports queue.enqueue(module); exportsInfo.setHasProvideInfo(); return callback(); } + const memCache = moduleMemCaches && moduleMemCaches.get(module); + const memCacheValue = memCache && memCache.get(this, module); + if (memCacheValue !== undefined) { + statRestoredFromMemCache++; + moduleGraph + .getExportsInfo(module) + .restoreProvided(memCacheValue); + return callback(); + } cache.get( module.identifier(), module.buildInfo.hash, @@ -94,7 +102,9 @@ class FlagDependencyExportsPlugin { if (err) return callback(err); /** @type {Set} */ - const modulesToStore = new Set(); + const modulesToStorePersistent = new Set(); + /** @type {Set} */ + const modulesToStoreTransient = new Set(); /** @type {Map>} */ const dependencies = new Map(); @@ -328,7 +338,9 @@ class FlagDependencyExportsPlugin { } if (cacheable) { - modulesToStore.add(module); + modulesToStorePersistent.add(module); + } else { + modulesToStoreTransient.add(module); } if (changed) { @@ -340,11 +352,12 @@ class FlagDependencyExportsPlugin { logger.log( `${Math.round( (100 * (statFlaggedUncached + statNotCached)) / - (statRestoredFromCache + + (statRestoredFromMemCache + + statRestoredFromCache + statNotCached + statFlaggedUncached + statNoExports) - )}% of exports of modules have been determined (${statNoExports} no declared exports, ${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${ + )}% of exports of modules have been determined (${statNoExports} no declared exports, ${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${statRestoredFromMemCache} from mem cache, ${ statQueueItemsProcessed - statNotCached - statFlaggedUncached @@ -353,26 +366,40 @@ class FlagDependencyExportsPlugin { logger.time("store provided exports into cache"); asyncLib.each( - modulesToStore, + modulesToStorePersistent, (module, callback) => { - if ( - module.buildInfo.cacheable !== true || - typeof module.buildInfo.hash !== "string" - ) { + if (typeof module.buildInfo.hash !== "string") { // not cacheable return callback(); } + const cachedData = moduleGraph + .getExportsInfo(module) + .getRestoreProvidedData(); + const memCache = + moduleMemCaches && moduleMemCaches.get(module); + if (memCache) { + memCache.set(this, module, cachedData); + } cache.store( module.identifier(), module.buildInfo.hash, - moduleGraph - .getExportsInfo(module) - .getRestoreProvidedData(), + cachedData, callback ); }, err => { logger.timeEnd("store provided exports into cache"); + if (moduleMemCaches) { + for (const module of modulesToStoreTransient) { + const memCache = moduleMemCaches.get(module); + if (memCache) { + const cachedData = moduleGraph + .getExportsInfo(module) + .getRestoreProvidedData(); + memCache.set(this, module, cachedData); + } + } + } callback(err); } ); diff --git a/lib/MemCache.js b/lib/MemCache.js new file mode 100644 index 00000000000..a6cbe5c527f --- /dev/null +++ b/lib/MemCache.js @@ -0,0 +1,45 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const WeakTupleMap = require("./util/WeakTupleMap"); + +class MemCache { + constructor() { + this._cache = new WeakTupleMap(); + } + + /** + * @template {any[]} T + * @template V + * @param {T} args arguments + * @returns {V | undefined} cached value + */ + get(...args) { + return this._cache.get(...args); + } + + /** + * @template {[...any[], any]} T + * @param {T} args arguments + * @returns {void} + */ + set(...args) { + this._cache.set(...args); + } + + /** + * @template {[...any[], (...args: any[]) => V]} T + * @template V + * @param {T} args arguments + * @returns {V} computed value or cached + */ + provide(...args) { + return this._cache.provide(...args); + } +} + +module.exports = MemCache; diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index a1dc892cf30..1b7ec57b5fb 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -544,6 +544,14 @@ class WebpackOptionsApply extends OptionsApply { const MemoryCachePlugin = require("./cache/MemoryCachePlugin"); new MemoryCachePlugin().apply(compiler); } + if (cacheOptions.cacheUnaffected) { + if (!options.experiments.cacheUnaffected) { + throw new Error( + "'cache.cacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" + ); + } + compiler.moduleMemCaches = new WeakMap(); + } break; } case "filesystem": { @@ -563,6 +571,14 @@ class WebpackOptionsApply extends OptionsApply { maxGenerations: cacheOptions.maxMemoryGenerations }).apply(compiler); } + if (cacheOptions.memoryCacheUnaffected) { + if (!options.experiments.cacheUnaffected) { + throw new Error( + "'cache.memoryCacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled" + ); + } + compiler.moduleMemCaches = new WeakMap(); + } switch (cacheOptions.store) { case "pack": { const IdleFileCachePlugin = require("./cache/IdleFileCachePlugin"); diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 4f30cf76661..64ffc7e5eb4 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -159,20 +159,21 @@ const applyWebpackOptionsDefaults = options => { D(options, "recordsInputPath", false); D(options, "recordsOutputPath", false); + applyExperimentsDefaults(options.experiments, { production, development }); + F(options, "cache", () => development ? { type: /** @type {"memory"} */ ("memory") } : false ); applyCacheDefaults(options.cache, { name: name || "default", mode: mode || "production", - development + development, + cacheUnaffected: options.experiments.cacheUnaffected }); const cache = !!options.cache; applySnapshotDefaults(options.snapshot, { production }); - applyExperimentsDefaults(options.experiments, { production, development }); - applyModuleDefaults(options.module, { cache, syncWebAssembly: options.experiments.syncWebAssembly, @@ -267,6 +268,7 @@ const applyExperimentsDefaults = (experiments, { production, development }) => { D(experiments, "lazyCompilation", false); D(experiments, "buildHttp", false); D(experiments, "futureDefaults", false); + D(experiments, "cacheUnaffected", experiments.futureDefaults); if (typeof experiments.buildHttp === "object") { D(experiments.buildHttp, "frozen", production); @@ -280,9 +282,13 @@ const applyExperimentsDefaults = (experiments, { production, development }) => { * @param {string} options.name name * @param {string} options.mode mode * @param {boolean} options.development is development mode + * @param {boolean} options.cacheUnaffected the cacheUnaffected experiment is enabled * @returns {void} */ -const applyCacheDefaults = (cache, { name, mode, development }) => { +const applyCacheDefaults = ( + cache, + { name, mode, development, cacheUnaffected } +) => { if (cache === false) return; switch (cache.type) { case "filesystem": @@ -326,12 +332,14 @@ const applyCacheDefaults = (cache, { name, mode, development }) => { D(cache, "maxMemoryGenerations", development ? 5 : Infinity); D(cache, "maxAge", 1000 * 60 * 60 * 24 * 60); // 1 month D(cache, "allowCollectingMemory", development); + D(cache, "memoryCacheUnaffected", development && cacheUnaffected); D(cache.buildDependencies, "defaultWebpack", [ path.resolve(__dirname, "..") + path.sep ]); break; case "memory": D(cache, "maxGenerations", Infinity); + D(cache, "cacheUnaffected", development && cacheUnaffected); break; } }; diff --git a/schemas/WebpackOptions.check.js b/schemas/WebpackOptions.check.js index 7119c6e87e8..637ea8fc734 100644 --- a/schemas/WebpackOptions.check.js +++ b/schemas/WebpackOptions.check.js @@ -3,4 +3,4 @@ * DO NOT MODIFY BY HAND. * Run `yarn special-lint-fix` to update */ -const e=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;module.exports=Fe,module.exports.default=Fe;const t={amd:{$ref:"#/definitions/Amd"},bail:{$ref:"#/definitions/Bail"},cache:{$ref:"#/definitions/CacheOptions"},context:{$ref:"#/definitions/Context"},dependencies:{$ref:"#/definitions/Dependencies"},devServer:{$ref:"#/definitions/DevServer"},devtool:{$ref:"#/definitions/DevTool"},entry:{$ref:"#/definitions/Entry"},experiments:{$ref:"#/definitions/Experiments"},externals:{$ref:"#/definitions/Externals"},externalsPresets:{$ref:"#/definitions/ExternalsPresets"},externalsType:{$ref:"#/definitions/ExternalsType"},ignoreWarnings:{$ref:"#/definitions/IgnoreWarnings"},infrastructureLogging:{$ref:"#/definitions/InfrastructureLogging"},loader:{$ref:"#/definitions/Loader"},mode:{$ref:"#/definitions/Mode"},module:{$ref:"#/definitions/ModuleOptions"},name:{$ref:"#/definitions/Name"},node:{$ref:"#/definitions/Node"},optimization:{$ref:"#/definitions/Optimization"},output:{$ref:"#/definitions/Output"},parallelism:{$ref:"#/definitions/Parallelism"},performance:{$ref:"#/definitions/Performance"},plugins:{$ref:"#/definitions/Plugins"},profile:{$ref:"#/definitions/Profile"},recordsInputPath:{$ref:"#/definitions/RecordsInputPath"},recordsOutputPath:{$ref:"#/definitions/RecordsOutputPath"},recordsPath:{$ref:"#/definitions/RecordsPath"},resolve:{$ref:"#/definitions/Resolve"},resolveLoader:{$ref:"#/definitions/ResolveLoader"},snapshot:{$ref:"#/definitions/SnapshotOptions"},stats:{$ref:"#/definitions/StatsValue"},target:{$ref:"#/definitions/Target"},watch:{$ref:"#/definitions/Watch"},watchOptions:{$ref:"#/definitions/WatchOptions"}},n=Object.prototype.hasOwnProperty,r={allowCollectingMemory:{type:"boolean"},buildDependencies:{type:"object",additionalProperties:{type:"array",items:{type:"string",minLength:1}}},cacheDirectory:{type:"string",absolutePath:!0},cacheLocation:{type:"string",absolutePath:!0},compression:{enum:[!1,"gzip","brotli"]},hashAlgorithm:{type:"string"},idleTimeout:{type:"number",minimum:0},idleTimeoutAfterLargeChanges:{type:"number",minimum:0},idleTimeoutForInitialStore:{type:"number",minimum:0},immutablePaths:{type:"array",items:{type:"string",absolutePath:!0,minLength:1}},managedPaths:{type:"array",items:{type:"string",absolutePath:!0,minLength:1}},maxAge:{type:"number",minimum:0},maxMemoryGenerations:{type:"number",minimum:0},name:{type:"string"},profile:{type:"boolean"},store:{enum:["pack"]},type:{enum:["filesystem"]},version:{type:"string"}};function s(t,{instancePath:o="",parentData:a,parentDataProperty:i,rootData:l=t}={}){let p=null,f=0;const u=f;let c=!1;const y=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var m=y===f;if(c=c||m,!c){const s=f;if(f==f)if(t&&"object"==typeof t&&!Array.isArray(t)){let e;if(void 0===t.type&&(e="type")){const t={params:{missingProperty:e}};null===p?p=[t]:p.push(t),f++}else{const e=f;for(const e in t)if("maxGenerations"!==e&&"type"!==e){const t={params:{additionalProperty:e}};null===p?p=[t]:p.push(t),f++;break}if(e===f){if(void 0!==t.maxGenerations){let e=t.maxGenerations;const n=f;if(f===n)if("number"==typeof e&&isFinite(e)){if(e<1||isNaN(e)){const e={params:{comparison:">=",limit:1}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}var h=n===f}else h=!0;if(h)if(void 0!==t.type){const e=f;if("memory"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}if(m=s===f,c=c||m,!c){const s=f;if(f==f)if(t&&"object"==typeof t&&!Array.isArray(t)){let s;if(void 0===t.type&&(s="type")){const e={params:{missingProperty:s}};null===p?p=[e]:p.push(e),f++}else{const s=f;for(const e in t)if(!n.call(r,e)){const t={params:{additionalProperty:e}};null===p?p=[t]:p.push(t),f++;break}if(s===f){if(void 0!==t.allowCollectingMemory){const e=f;if("boolean"!=typeof t.allowCollectingMemory){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}var d=e===f}else d=!0;if(d){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=f;if(f===r)if(Array.isArray(n)){const e=n.length;for(let t=0;t=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.idleTimeoutAfterLargeChanges){let e=t.idleTimeoutAfterLargeChanges;const n=f;if(f===n)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.idleTimeoutForInitialStore){let e=t.idleTimeoutForInitialStore;const n=f;if(f===n)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r)if(Array.isArray(n)){const t=n.length;for(let r=0;r=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.maxMemoryGenerations){let e=t.maxMemoryGenerations;const n=f;if(f===n)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.name){const e=f;if("string"!=typeof t.name){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d){if(void 0!==t.profile){const e=f;if("boolean"!=typeof t.profile){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d){if(void 0!==t.store){const e=f;if("pack"!==t.store){const e={params:{}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d){if(void 0!==t.type){const e=f;if("filesystem"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d)if(void 0!==t.version){const e=f;if("string"!=typeof t.version){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0}}}}}}}}}}}}}}}}}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}m=s===f,c=c||m}}if(!c){const e={params:{}};return null===p?p=[e]:p.push(e),f++,s.errors=p,!1}return f=u,null!==p&&(u?p.length=u:p=null),s.errors=p,0===f}function o(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:a=e}={}){let i=null,l=0;const p=l;let f=!1;const u=l;if(!0!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var c=u===l;if(f=f||c,!f){const o=l;s(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:a})||(i=null===i?s.errors:i.concat(s.errors),l=i.length),c=o===l,f=f||c}if(!f){const e={params:{}};return null===i?i=[e]:i.push(e),l++,o.errors=i,!1}return l=p,null!==i&&(p?i.length=p:i=null),o.errors=i,0===l}const a={chunkLoading:{$ref:"#/definitions/ChunkLoading"},dependOn:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},{type:"string",minLength:1}]},filename:{$ref:"#/definitions/EntryFilename"},import:{$ref:"#/definitions/EntryItem"},layer:{$ref:"#/definitions/Layer"},library:{$ref:"#/definitions/LibraryOptions"},publicPath:{$ref:"#/definitions/PublicPath"},runtime:{$ref:"#/definitions/EntryRuntime"},wasmLoading:{$ref:"#/definitions/WasmLoading"}};function i(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const l=a;let p=!1;const f=a;if(!1!==e){const e={params:{}};null===o?o=[e]:o.push(e),a++}var u=f===a;if(p=p||u,!p){const t=a,n=a;let r=!1;const s=a;if("jsonp"!==e&&"import-scripts"!==e&&"require"!==e&&"async-node"!==e&&"import"!==e){const e={params:{}};null===o?o=[e]:o.push(e),a++}var c=s===a;if(r=r||c,!r){const t=a;if("string"!=typeof e){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a,r=r||c}if(r)a=n,null!==o&&(n?o.length=n:o=null);else{const e={params:{}};null===o?o=[e]:o.push(e),a++}u=t===a,p=p||u}if(!p){const e={params:{}};return null===o?o=[e]:o.push(e),a++,i.errors=o,!1}return a=l,null!==o&&(l?o.length=l:o=null),i.errors=o,0===a}function l(t,{instancePath:n="",parentData:r,parentDataProperty:s,rootData:o=t}={}){let a=null,i=0;const p=i;let f=!1,u=null;const c=i,y=i;let m=!1;const h=i;if(i===h)if("string"==typeof t){if(t.includes("!")||!1!==e.test(t)){const e={params:{}};null===a?a=[e]:a.push(e),i++}else if(t.length<1){const e={params:{}};null===a?a=[e]:a.push(e),i++}}else{const e={params:{type:"string"}};null===a?a=[e]:a.push(e),i++}var d=h===i;if(m=m||d,!m){const e=i;if(!(t instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),i++}d=e===i,m=m||d}if(m)i=y,null!==a&&(y?a.length=y:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),i++}if(c===i&&(f=!0,u=0),!f){const e={params:{passingSchemas:u}};return null===a?a=[e]:a.push(e),i++,l.errors=a,!1}return i=p,null!==a&&(p?a.length=p:a=null),l.errors=a,0===i}function p(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const f=a;if("string"!=typeof e){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}var u=f===a;if(l=l||u,!l){const t=a;if(a==a)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=a;for(const t in e)if("amd"!==t&&"commonjs"!==t&&"commonjs2"!==t&&"root"!==t){const e={params:{additionalProperty:t}};null===o?o=[e]:o.push(e),a++;break}if(t===a){if(void 0!==e.amd){const t=a;if("string"!=typeof e.amd){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}var c=t===a}else c=!0;if(c){if(void 0!==e.commonjs){const t=a;if("string"!=typeof e.commonjs){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a}else c=!0;if(c){if(void 0!==e.commonjs2){const t=a;if("string"!=typeof e.commonjs2){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a}else c=!0;if(c)if(void 0!==e.root){const t=a;if("string"!=typeof e.root){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a}else c=!0}}}}else{const e={params:{type:"object"}};null===o?o=[e]:o.push(e),a++}u=t===a,l=l||u}if(!l){const e={params:{}};return null===o?o=[e]:o.push(e),a++,p.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),p.errors=o,0===a}function f(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;if(a===p)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===o?o=[e]:o.push(e),a++}else{const t=e.length;for(let n=0;n1){const r={};for(;n--;){let s=t[n];if("string"==typeof s){if("number"==typeof r[s]){e=r[s];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[s]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var g=o===f;if(s=s||g,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}g=e===f,s=s||g}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h){if(void 0!==e.filename){const n=f;l(e.filename,{instancePath:t+"/filename",parentData:e,parentDataProperty:"filename",rootData:o})||(p=null===p?l.errors:p.concat(l.errors),f=p.length),h=n===f}else h=!0;if(h){if(void 0!==e.import){let t=e.import;const n=f,r=f;let s=!1;const o=f;if(f===o)if(Array.isArray(t))if(t.length<1){const e={params:{limit:1}};null===p?p=[e]:p.push(e),f++}else{var b=!0;const e=t.length;for(let n=0;n1){const r={};for(;n--;){let s=t[n];if("string"==typeof s){if("number"==typeof r[s]){e=r[s];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[s]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var v=o===f;if(s=s||v,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=e===f,s=s||v}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h){if(void 0!==e.layer){let t=e.layer;const n=f,r=f;let s=!1;const o=f;if(null!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var D=o===f;if(s=s||D,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}D=e===f,s=s||D}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h){if(void 0!==e.library){const n=f;u(e.library,{instancePath:t+"/library",parentData:e,parentDataProperty:"library",rootData:o})||(p=null===p?u.errors:p.concat(u.errors),f=p.length),h=n===f}else h=!0;if(h){if(void 0!==e.publicPath){const n=f;c(e.publicPath,{instancePath:t+"/publicPath",parentData:e,parentDataProperty:"publicPath",rootData:o})||(p=null===p?c.errors:p.concat(c.errors),f=p.length),h=n===f}else h=!0;if(h){if(void 0!==e.runtime){let t=e.runtime;const n=f,r=f;let s=!1;const o=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=o===f;if(s=s||P,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=e===f,s=s||P}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h)if(void 0!==e.wasmLoading){const n=f;y(e.wasmLoading,{instancePath:t+"/wasmLoading",parentData:e,parentDataProperty:"wasmLoading",rootData:o})||(p=null===p?y.errors:p.concat(y.errors),f=p.length),h=n===f}else h=!0}}}}}}}}}}}return m.errors=p,0===f}function h(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;if(0===a){if(!e||"object"!=typeof e||Array.isArray(e))return h.errors=[{params:{type:"object"}}],!1;for(const n in e){let r=e[n];const f=a,u=a;let c=!1;const y=a,d=a;let g=!1;const b=a;if(a===b)if(Array.isArray(r))if(r.length<1){const e={params:{limit:1}};null===o?o=[e]:o.push(e),a++}else{var i=!0;const e=r.length;for(let t=0;t1){const n={};for(;t--;){let s=r[t];if("string"==typeof s){if("number"==typeof n[s]){e=n[s];const r={params:{i:t,j:e}};null===o?o=[r]:o.push(r),a++;break}n[s]=t}}}}}else{const e={params:{type:"array"}};null===o?o=[e]:o.push(e),a++}var l=b===a;if(g=g||l,!g){const e=a;if(a===e)if("string"==typeof r){if(r.length<1){const e={params:{}};null===o?o=[e]:o.push(e),a++}}else{const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}l=e===a,g=g||l}if(g)a=d,null!==o&&(d?o.length=d:o=null);else{const e={params:{}};null===o?o=[e]:o.push(e),a++}var p=y===a;if(c=c||p,!c){const i=a;m(r,{instancePath:t+"/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:n,rootData:s})||(o=null===o?m.errors:o.concat(m.errors),a=o.length),p=i===a,c=c||p}if(!c){const e={params:{}};return null===o?o=[e]:o.push(e),a++,h.errors=o,!1}if(a=u,null!==o&&(u?o.length=u:o=null),f!==a)break}}return h.errors=o,0===a}function d(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1,p=null;const f=a,u=a;let c=!1;const y=a;if(a===y)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===o?o=[e]:o.push(e),a++}else{var m=!0;const t=e.length;for(let n=0;n1){const r={};for(;n--;){let s=e[n];if("string"==typeof s){if("number"==typeof r[s]){t=r[s];const e={params:{i:n,j:t}};null===o?o=[e]:o.push(e),a++;break}r[s]=n}}}}}else{const e={params:{type:"array"}};null===o?o=[e]:o.push(e),a++}var h=y===a;if(c=c||h,!c){const t=a;if(a===t)if("string"==typeof e){if(e.length<1){const e={params:{}};null===o?o=[e]:o.push(e),a++}}else{const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}h=t===a,c=c||h}if(c)a=u,null!==o&&(u?o.length=u:o=null);else{const e={params:{}};null===o?o=[e]:o.push(e),a++}if(f===a&&(l=!0,p=0),!l){const e={params:{passingSchemas:p}};return null===o?o=[e]:o.push(e),a++,d.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),d.errors=o,0===a}function g(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;h(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:s})||(o=null===o?h.errors:o.concat(h.errors),a=o.length);var f=p===a;if(l=l||f,!l){const i=a;d(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:s})||(o=null===o?d.errors:o.concat(d.errors),a=o.length),f=i===a,l=l||f}if(!l){const e={params:{}};return null===o?o=[e]:o.push(e),a++,g.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),g.errors=o,0===a}function b(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;if(!(e instanceof Function)){const e={params:{}};null===o?o=[e]:o.push(e),a++}var f=p===a;if(l=l||f,!l){const i=a;g(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:s})||(o=null===o?g.errors:o.concat(g.errors),a=o.length),f=i===a,l=l||f}if(!l){const e={params:{}};return null===o?o=[e]:o.push(e),a++,b.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),b.errors=o,0===a}const v={asset:{type:"boolean"},asyncWebAssembly:{type:"boolean"},buildHttp:{anyOf:[{type:"boolean"},{$ref:"#/definitions/HttpUriOptions"}]},futureDefaults:{type:"boolean"},layers:{type:"boolean"},lazyCompilation:{anyOf:[{type:"boolean"},{type:"object",additionalProperties:!1,properties:{backend:{instanceof:"Function"},client:{type:"string"},entries:{type:"boolean"},imports:{type:"boolean"},test:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"}]}}}]},outputModule:{type:"boolean"},syncWebAssembly:{type:"boolean"},topLevelAwait:{type:"boolean"}};function D(t,{instancePath:r="",parentData:s,parentDataProperty:o,rootData:a=t}={}){let i=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return D.errors=[{params:{type:"object"}}],!1;{const r=l;for(const e in t)if(!n.call(v,e))return D.errors=[{params:{additionalProperty:e}}],!1;if(r===l){if(void 0!==t.asset){const e=l;if("boolean"!=typeof t.asset)return D.errors=[{params:{type:"boolean"}}],!1;var p=e===l}else p=!0;if(p){if(void 0!==t.asyncWebAssembly){const e=l;if("boolean"!=typeof t.asyncWebAssembly)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.buildHttp){let n=t.buildHttp;const r=l,s=l;let o=!1;const a=l;if("boolean"!=typeof n){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}var f=a===l;if(o=o||f,!o){const t=l;if(l==l)if(n&&"object"==typeof n&&!Array.isArray(n)){const t=l;for(const e in n)if("cacheLocation"!==e&&"frozen"!==e&&"lockfileLocation"!==e&&"upgrade"!==e){const t={params:{additionalProperty:e}};null===i?i=[t]:i.push(t),l++;break}if(t===l){if(void 0!==n.cacheLocation){let t=n.cacheLocation;const r=l,s=l;let o=!1;const a=l;if(!1!==t){const e={params:{}};null===i?i=[e]:i.push(e),l++}var u=a===l;if(o=o||u,!o){const n=l;if(l===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}u=n===l,o=o||u}if(o)l=s,null!==i&&(s?i.length=s:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}var c=r===l}else c=!0;if(c){if(void 0!==n.frozen){const e=l;if("boolean"!=typeof n.frozen){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}c=e===l}else c=!0;if(c){if(void 0!==n.lockfileLocation){let t=n.lockfileLocation;const r=l;if(l===r)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}c=r===l}else c=!0;if(c)if(void 0!==n.upgrade){const e=l;if("boolean"!=typeof n.upgrade){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}c=e===l}else c=!0}}}}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}f=t===l,o=o||f}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),l++,D.errors=i,!1}l=s,null!==i&&(s?i.length=s:i=null),p=r===l}else p=!0;if(p){if(void 0!==t.futureDefaults){const e=l;if("boolean"!=typeof t.futureDefaults)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.layers){const e=l;if("boolean"!=typeof t.layers)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.lazyCompilation){let e=t.lazyCompilation;const n=l,r=l;let s=!1;const o=l;if("boolean"!=typeof e){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}var y=o===l;if(s=s||y,!s){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=l;for(const t in e)if("backend"!==t&&"client"!==t&&"entries"!==t&&"imports"!==t&&"test"!==t){const e={params:{additionalProperty:t}};null===i?i=[e]:i.push(e),l++;break}if(t===l){if(void 0!==e.backend){const t=l;if(!(e.backend instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var m=t===l}else m=!0;if(m){if(void 0!==e.client){const t=l;if("string"!=typeof e.client){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}m=t===l}else m=!0;if(m){if(void 0!==e.entries){const t=l;if("boolean"!=typeof e.entries){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}m=t===l}else m=!0;if(m){if(void 0!==e.imports){const t=l;if("boolean"!=typeof e.imports){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}m=t===l}else m=!0;if(m)if(void 0!==e.test){let t=e.test;const n=l,r=l;let s=!1;const o=l;if(!(t instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var h=o===l;if(s=s||h,!s){const e=l;if("string"!=typeof t){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(h=e===l,s=s||h,!s){const e=l;if(!(t instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}h=e===l,s=s||h}}if(s)l=r,null!==i&&(r?i.length=r:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}m=n===l}else m=!0}}}}}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}y=t===l,s=s||y}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,D.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.outputModule){const e=l;if("boolean"!=typeof t.outputModule)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.syncWebAssembly){const e=l;if("boolean"!=typeof t.syncWebAssembly)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p)if(void 0!==t.topLevelAwait){const e=l;if("boolean"!=typeof t.topLevelAwait)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}return D.errors=i,0===l}const P={validate:A};function A(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;if(!(e instanceof RegExp)){const e={params:{}};null===o?o=[e]:o.push(e),a++}var f=p===a;if(l=l||f,!l){const n=a;if("string"!=typeof e){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}if(f=n===a,l=l||f,!l){const n=a;if(a===n)if(e&&"object"==typeof e&&!Array.isArray(e)){const n=a;for(const t in e)if("byLayer"!==t){let n=e[t];const r=a,s=a;let i=!1;const l=a;if(a===l)if(Array.isArray(n)){const e=n.length;for(let t=0;t=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var u=y===l;if(c=c||u,!c){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}u=t===l,c=c||u}if(c)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,s=l;let o=!1;const a=l;if(l===a)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===i?i=[e]:i.push(e),l++}else if(n.length<1){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}var c=a===l;if(o=o||c,!o){const e=l;if(!(n instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}c=e===l,o=o||c}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=s,null!==i&&(s?i.length=s:i=null),p=r===l}else p=!0;if(p){if(void 0!==t.idHint){const e=l;if("string"!=typeof t.idHint)return oe.errors=[{params:{type:"string"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.layer){let e=t.layer;const n=l,r=l;let s=!1;const o=l;if(!(e instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var y=o===l;if(s=s||y,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(y=t===l,s=s||y,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}y=t===l,s=s||y}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var m=c===l;if(u=u||m,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}m=t===l,u=u||m}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var h=c===l;if(u=u||h,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}h=t===l,u=u||h}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var d=c===l;if(u=u||d,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}d=t===l,u=u||d}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var g=c===l;if(u=u||g,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}g=t===l,u=u||g}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var b=c===l;if(u=u||b,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}b=t===l,u=u||b}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let s=!1;const o=l;if(!1!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var v=o===l;if(s=s||v,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(v=t===l,s=s||v,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}v=t===l,s=s||v}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.priority){let e=t.priority;const n=l;if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;p=n===l}else p=!0;if(p){if(void 0!==t.reuseExistingChunk){const e=l;if("boolean"!=typeof t.reuseExistingChunk)return oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.test){let e=t.test;const n=l,r=l;let s=!1;const o=l;if(!(e instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var D=o===l;if(s=s||D,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(D=t===l,s=s||D,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}D=t===l,s=s||D}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.type){let e=t.type;const n=l,r=l;let s=!1;const o=l;if(!(e instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var P=o===l;if(s=s||P,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(P=t===l,s=s||P,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}P=t===l,s=s||P}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}}}return oe.errors=i,0===l}function ae(t,{instancePath:r="",parentData:s,parentDataProperty:o,rootData:a=t}={}){let i=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return ae.errors=[{params:{type:"object"}}],!1;{const s=l;for(const e in t)if(!n.call(re,e))return ae.errors=[{params:{additionalProperty:e}}],!1;if(s===l){if(void 0!==t.automaticNameDelimiter){let e=t.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof e)return ae.errors=[{params:{type:"string"}}],!1;if(e.length<1)return ae.errors=[{params:{}}],!1}var p=n===l}else p=!0;if(p){if(void 0!==t.cacheGroups){let e=t.cacheGroups;const n=l,s=l,o=l;if(l===o)if(e&&"object"==typeof e&&!Array.isArray(e)){let t;if(void 0===e.test&&(t="test")){const e={};null===i?i=[e]:i.push(e),l++}else if(void 0!==e.test){let t=e.test;const n=l;let r=!1;const s=l;if(!(t instanceof RegExp)){const e={};null===i?i=[e]:i.push(e),l++}var f=s===l;if(r=r||f,!r){const e=l;if("string"!=typeof t){const e={};null===i?i=[e]:i.push(e),l++}if(f=e===l,r=r||f,!r){const e=l;if(!(t instanceof Function)){const e={};null===i?i=[e]:i.push(e),l++}f=e===l,r=r||f}}if(r)l=n,null!==i&&(n?i.length=n:i=null);else{const e={};null===i?i=[e]:i.push(e),l++}}}else{const e={};null===i?i=[e]:i.push(e),l++}if(o===l)return ae.errors=[{params:{}}],!1;if(l=s,null!==i&&(s?i.length=s:i=null),l===n){if(!e||"object"!=typeof e||Array.isArray(e))return ae.errors=[{params:{type:"object"}}],!1;for(const t in e){let n=e[t];const s=l,o=l;let p=!1;const f=l;if(!1!==n){const e={params:{}};null===i?i=[e]:i.push(e),l++}var u=f===l;if(p=p||u,!p){const s=l;if(!(n instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}if(u=s===l,p=p||u,!p){const s=l;if("string"!=typeof n){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(u=s===l,p=p||u,!p){const s=l;if(!(n instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}if(u=s===l,p=p||u,!p){const s=l;oe(n,{instancePath:r+"/cacheGroups/"+t.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:t,rootData:a})||(i=null===i?oe.errors:i.concat(oe.errors),l=i.length),u=s===l,p=p||u}}}}if(!p){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}if(l=o,null!==i&&(o?i.length=o:i=null),s!==l)break}}p=n===l}else p=!0;if(p){if(void 0!==t.chunks){let e=t.chunks;const n=l,r=l;let s=!1;const o=l;if("initial"!==e&&"async"!==e&&"all"!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var c=o===l;if(s=s||c,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}c=t===l,s=s||c}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.defaultSizeTypes){let e=t.defaultSizeTypes;const n=l;if(l===n){if(!Array.isArray(e))return ae.errors=[{params:{type:"array"}}],!1;if(e.length<1)return ae.errors=[{params:{limit:1}}],!1;{const t=e.length;for(let n=0;n=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var y=c===l;if(u=u||y,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}y=t===l,u=u||y}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.fallbackCacheGroup){let e=t.fallbackCacheGroup;const n=l;if(l===n){if(!e||"object"!=typeof e||Array.isArray(e))return ae.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in e)if("automaticNameDelimiter"!==t&&"maxAsyncSize"!==t&&"maxInitialSize"!==t&&"maxSize"!==t&&"minSize"!==t)return ae.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==e.automaticNameDelimiter){let t=e.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof t)return ae.errors=[{params:{type:"string"}}],!1;if(t.length<1)return ae.errors=[{params:{}}],!1}var m=n===l}else m=!0;if(m){if(void 0!==e.maxAsyncSize){let t=e.maxAsyncSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var h=u===l;if(f=f||h,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}h=e===l,f=f||h}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxInitialSize){let t=e.maxInitialSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var d=u===l;if(f=f||d,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}d=e===l,f=f||d}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxSize){let t=e.maxSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var g=u===l;if(f=f||g,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}g=e===l,f=f||g}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0;if(m)if(void 0!==e.minSize){let t=e.minSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var b=u===l;if(f=f||b,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}b=e===l,f=f||b}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0}}}}}}p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,s=l;let o=!1;const a=l;if(l===a)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===i?i=[e]:i.push(e),l++}else if(n.length<1){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}var v=a===l;if(o=o||v,!o){const e=l;if(!(n instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}v=e===l,o=o||v}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=s,null!==i&&(s?i.length=s:i=null),p=r===l}else p=!0;if(p){if(void 0!==t.hidePathInfo){const e=l;if("boolean"!=typeof t.hidePathInfo)return ae.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return ae.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ae.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var D=c===l;if(u=u||D,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}D=t===l,u=u||D}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return ae.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ae.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var P=c===l;if(u=u||P,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}P=t===l,u=u||P}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var A=c===l;if(u=u||A,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}A=t===l,u=u||A}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return ae.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ae.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var x=c===l;if(u=u||x,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}x=t===l,u=u||x}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var k=c===l;if(u=u||k,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}k=t===l,u=u||k}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let s=!1;const o=l;if(!1!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var j=o===l;if(s=s||j,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(j=t===l,s=s||j,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}j=t===l,s=s||j}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return ae.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}return ae.errors=i,0===l}function ie(e,{instancePath:t="",parentData:r,parentDataProperty:s,rootData:o=e}={}){let a=null,i=0;if(0===i){if(!e||"object"!=typeof e||Array.isArray(e))return ie.errors=[{params:{type:"object"}}],!1;{const r=i;for(const t in e)if(!n.call(ne,t))return ie.errors=[{params:{additionalProperty:t}}],!1;if(r===i){if(void 0!==e.checkWasmTypes){const t=i;if("boolean"!=typeof e.checkWasmTypes)return ie.errors=[{params:{type:"boolean"}}],!1;var l=t===i}else l=!0;if(l){if(void 0!==e.chunkIds){let t=e.chunkIds;const n=i;if("natural"!==t&&"named"!==t&&"deterministic"!==t&&"size"!==t&&"total-size"!==t&&!1!==t)return ie.errors=[{params:{}}],!1;l=n===i}else l=!0;if(l){if(void 0!==e.concatenateModules){const t=i;if("boolean"!=typeof e.concatenateModules)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.emitOnErrors){const t=i;if("boolean"!=typeof e.emitOnErrors)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.flagIncludedChunks){const t=i;if("boolean"!=typeof e.flagIncludedChunks)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.innerGraph){const t=i;if("boolean"!=typeof e.innerGraph)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.mangleExports){let t=e.mangleExports;const n=i,r=i;let s=!1;const o=i;if("size"!==t&&"deterministic"!==t){const e={params:{}};null===a?a=[e]:a.push(e),i++}var p=o===i;if(s=s||p,!s){const e=i;if("boolean"!=typeof t){const e={params:{type:"boolean"}};null===a?a=[e]:a.push(e),i++}p=e===i,s=s||p}if(!s){const e={params:{}};return null===a?a=[e]:a.push(e),i++,ie.errors=a,!1}i=r,null!==a&&(r?a.length=r:a=null),l=n===i}else l=!0;if(l){if(void 0!==e.mangleWasmImports){const t=i;if("boolean"!=typeof e.mangleWasmImports)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.mergeDuplicateChunks){const t=i;if("boolean"!=typeof e.mergeDuplicateChunks)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.minimize){const t=i;if("boolean"!=typeof e.minimize)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.minimizer){let t=e.minimizer;const n=i;if(i===n){if(!Array.isArray(t))return ie.errors=[{params:{type:"array"}}],!1;{const e=t.length;for(let n=0;n=",limit:1}}],!1}m=n===f}else m=!0;if(m){if(void 0!==t.hashFunction){let e=t.hashFunction;const n=f,r=f;let s=!1;const o=f;if(f===o)if("string"==typeof e){if(e.length<1){const e={params:{}};null===l?l=[e]:l.push(e),f++}}else{const e={params:{type:"string"}};null===l?l=[e]:l.push(e),f++}var v=o===f;if(s=s||v,!s){const t=f;if(!(e instanceof Function)){const e={params:{}};null===l?l=[e]:l.push(e),f++}v=t===f,s=s||v}if(!s){const e={params:{}};return null===l?l=[e]:l.push(e),f++,de.errors=l,!1}f=r,null!==l&&(r?l.length=r:l=null),m=n===f}else m=!0;if(m){if(void 0!==t.hashSalt){let e=t.hashSalt;const n=f;if(f==f){if("string"!=typeof e)return de.errors=[{params:{type:"string"}}],!1;if(e.length<1)return de.errors=[{params:{}}],!1}m=n===f}else m=!0;if(m){if(void 0!==t.hotUpdateChunkFilename){let n=t.hotUpdateChunkFilename;const r=f;if(f==f){if("string"!=typeof n)return de.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return de.errors=[{params:{}}],!1}m=r===f}else m=!0;if(m){if(void 0!==t.hotUpdateGlobal){const e=f;if("string"!=typeof t.hotUpdateGlobal)return de.errors=[{params:{type:"string"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.hotUpdateMainFilename){let n=t.hotUpdateMainFilename;const r=f;if(f==f){if("string"!=typeof n)return de.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return de.errors=[{params:{}}],!1}m=r===f}else m=!0;if(m){if(void 0!==t.iife){const e=f;if("boolean"!=typeof t.iife)return de.errors=[{params:{type:"boolean"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.importFunctionName){const e=f;if("string"!=typeof t.importFunctionName)return de.errors=[{params:{type:"string"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.importMetaName){const e=f;if("string"!=typeof t.importMetaName)return de.errors=[{params:{type:"string"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.library){const e=f;he(t.library,{instancePath:r+"/library",parentData:t,parentDataProperty:"library",rootData:a})||(l=null===l?he.errors:l.concat(he.errors),f=l.length),m=e===f}else m=!0;if(m){if(void 0!==t.libraryExport){let e=t.libraryExport;const n=f,r=f;let s=!1,o=null;const a=f,i=f;let p=!1;const u=f;if(f===u)if(Array.isArray(e)){const t=e.length;for(let n=0;n=",limit:1}}],!1}c=t===f}else c=!0;if(c){if(void 0!==r.performance){const e=f;ge(r.performance,{instancePath:s+"/performance",parentData:r,parentDataProperty:"performance",rootData:l})||(p=null===p?ge.errors:p.concat(ge.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.plugins){const e=f;be(r.plugins,{instancePath:s+"/plugins",parentData:r,parentDataProperty:"plugins",rootData:l})||(p=null===p?be.errors:p.concat(be.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.profile){const e=f;if("boolean"!=typeof r.profile)return Fe.errors=[{params:{type:"boolean"}}],!1;c=e===f}else c=!0;if(c){if(void 0!==r.recordsInputPath){let t=r.recordsInputPath;const n=f,s=f;let o=!1;const a=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var g=a===f;if(o=o||g,!o){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}g=n===f,o=o||g}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,Fe.errors=p,!1}f=s,null!==p&&(s?p.length=s:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsOutputPath){let t=r.recordsOutputPath;const n=f,s=f;let o=!1;const a=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var v=a===f;if(o=o||v,!o){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=n===f,o=o||v}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,Fe.errors=p,!1}f=s,null!==p&&(s?p.length=s:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsPath){let t=r.recordsPath;const n=f,s=f;let o=!1;const a=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=a===f;if(o=o||P,!o){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=n===f,o=o||P}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,Fe.errors=p,!1}f=s,null!==p&&(s?p.length=s:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.resolve){const e=f;ve(r.resolve,{instancePath:s+"/resolve",parentData:r,parentDataProperty:"resolve",rootData:l})||(p=null===p?ve.errors:p.concat(ve.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.resolveLoader){const e=f;De(r.resolveLoader,{instancePath:s+"/resolveLoader",parentData:r,parentDataProperty:"resolveLoader",rootData:l})||(p=null===p?De.errors:p.concat(De.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.snapshot){let t=r.snapshot;const n=f;if(f==f){if(!t||"object"!=typeof t||Array.isArray(t))return Fe.errors=[{params:{type:"object"}}],!1;{const n=f;for(const e in t)if("buildDependencies"!==e&&"immutablePaths"!==e&&"managedPaths"!==e&&"module"!==e&&"resolve"!==e&&"resolveBuildDependencies"!==e)return Fe.errors=[{params:{additionalProperty:e}}],!1;if(n===f){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n){if(!e||"object"!=typeof e||Array.isArray(e))return Fe.errors=[{params:{type:"object"}}],!1;{const t=f;for(const t in e)if("hash"!==t&&"timestamp"!==t)return Fe.errors=[{params:{additionalProperty:t}}],!1;if(t===f){if(void 0!==e.hash){const t=f;if("boolean"!=typeof e.hash)return Fe.errors=[{params:{type:"boolean"}}],!1;var A=t===f}else A=!0;if(A)if(void 0!==e.timestamp){const t=f;if("boolean"!=typeof e.timestamp)return Fe.errors=[{params:{type:"boolean"}}],!1;A=t===f}else A=!0}}}var k=n===f}else k=!0;if(k){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r){if(!Array.isArray(n))return Fe.errors=[{params:{type:"array"}}],!1;{const t=n.length;for(let r=0;r=",limit:1}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}h=n===f}else h=!0;if(h)if(void 0!==t.type){const e=f;if("memory"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}h=e===f}else h=!0}}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}if(m=s===f,c=c||m,!c){const s=f;if(f==f)if(t&&"object"==typeof t&&!Array.isArray(t)){let s;if(void 0===t.type&&(s="type")){const e={params:{missingProperty:s}};null===p?p=[e]:p.push(e),f++}else{const s=f;for(const e in t)if(!n.call(r,e)){const t={params:{additionalProperty:e}};null===p?p=[t]:p.push(t),f++;break}if(s===f){if(void 0!==t.allowCollectingMemory){const e=f;if("boolean"!=typeof t.allowCollectingMemory){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}var d=e===f}else d=!0;if(d){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=f;if(f===r)if(Array.isArray(n)){const e=n.length;for(let t=0;t=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.idleTimeoutAfterLargeChanges){let e=t.idleTimeoutAfterLargeChanges;const n=f;if(f===n)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.idleTimeoutForInitialStore){let e=t.idleTimeoutForInitialStore;const n=f;if(f===n)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r)if(Array.isArray(n)){const t=n.length;for(let r=0;r=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.maxMemoryGenerations){let e=t.maxMemoryGenerations;const n=f;if(f===n)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"number"}};null===p?p=[e]:p.push(e),f++}d=n===f}else d=!0;if(d){if(void 0!==t.memoryCacheUnaffected){const e=f;if("boolean"!=typeof t.memoryCacheUnaffected){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d){if(void 0!==t.name){const e=f;if("string"!=typeof t.name){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d){if(void 0!==t.profile){const e=f;if("boolean"!=typeof t.profile){const e={params:{type:"boolean"}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d){if(void 0!==t.store){const e=f;if("pack"!==t.store){const e={params:{}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d){if(void 0!==t.type){const e=f;if("filesystem"!==t.type){const e={params:{}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0;if(d)if(void 0!==t.version){const e=f;if("string"!=typeof t.version){const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}d=e===f}else d=!0}}}}}}}}}}}}}}}}}}}}else{const e={params:{type:"object"}};null===p?p=[e]:p.push(e),f++}m=s===f,c=c||m}}if(!c){const e={params:{}};return null===p?p=[e]:p.push(e),f++,s.errors=p,!1}return f=u,null!==p&&(u?p.length=u:p=null),s.errors=p,0===f}function o(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:a=e}={}){let i=null,l=0;const p=l;let f=!1;const u=l;if(!0!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var c=u===l;if(f=f||c,!f){const o=l;s(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:a})||(i=null===i?s.errors:i.concat(s.errors),l=i.length),c=o===l,f=f||c}if(!f){const e={params:{}};return null===i?i=[e]:i.push(e),l++,o.errors=i,!1}return l=p,null!==i&&(p?i.length=p:i=null),o.errors=i,0===l}const a={chunkLoading:{$ref:"#/definitions/ChunkLoading"},dependOn:{anyOf:[{type:"array",items:{type:"string",minLength:1},minItems:1,uniqueItems:!0},{type:"string",minLength:1}]},filename:{$ref:"#/definitions/EntryFilename"},import:{$ref:"#/definitions/EntryItem"},layer:{$ref:"#/definitions/Layer"},library:{$ref:"#/definitions/LibraryOptions"},publicPath:{$ref:"#/definitions/PublicPath"},runtime:{$ref:"#/definitions/EntryRuntime"},wasmLoading:{$ref:"#/definitions/WasmLoading"}};function i(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const l=a;let p=!1;const f=a;if(!1!==e){const e={params:{}};null===o?o=[e]:o.push(e),a++}var u=f===a;if(p=p||u,!p){const t=a,n=a;let r=!1;const s=a;if("jsonp"!==e&&"import-scripts"!==e&&"require"!==e&&"async-node"!==e&&"import"!==e){const e={params:{}};null===o?o=[e]:o.push(e),a++}var c=s===a;if(r=r||c,!r){const t=a;if("string"!=typeof e){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a,r=r||c}if(r)a=n,null!==o&&(n?o.length=n:o=null);else{const e={params:{}};null===o?o=[e]:o.push(e),a++}u=t===a,p=p||u}if(!p){const e={params:{}};return null===o?o=[e]:o.push(e),a++,i.errors=o,!1}return a=l,null!==o&&(l?o.length=l:o=null),i.errors=o,0===a}function l(t,{instancePath:n="",parentData:r,parentDataProperty:s,rootData:o=t}={}){let a=null,i=0;const p=i;let f=!1,u=null;const c=i,y=i;let m=!1;const h=i;if(i===h)if("string"==typeof t){if(t.includes("!")||!1!==e.test(t)){const e={params:{}};null===a?a=[e]:a.push(e),i++}else if(t.length<1){const e={params:{}};null===a?a=[e]:a.push(e),i++}}else{const e={params:{type:"string"}};null===a?a=[e]:a.push(e),i++}var d=h===i;if(m=m||d,!m){const e=i;if(!(t instanceof Function)){const e={params:{}};null===a?a=[e]:a.push(e),i++}d=e===i,m=m||d}if(m)i=y,null!==a&&(y?a.length=y:a=null);else{const e={params:{}};null===a?a=[e]:a.push(e),i++}if(c===i&&(f=!0,u=0),!f){const e={params:{passingSchemas:u}};return null===a?a=[e]:a.push(e),i++,l.errors=a,!1}return i=p,null!==a&&(p?a.length=p:a=null),l.errors=a,0===i}function p(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const f=a;if("string"!=typeof e){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}var u=f===a;if(l=l||u,!l){const t=a;if(a==a)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=a;for(const t in e)if("amd"!==t&&"commonjs"!==t&&"commonjs2"!==t&&"root"!==t){const e={params:{additionalProperty:t}};null===o?o=[e]:o.push(e),a++;break}if(t===a){if(void 0!==e.amd){const t=a;if("string"!=typeof e.amd){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}var c=t===a}else c=!0;if(c){if(void 0!==e.commonjs){const t=a;if("string"!=typeof e.commonjs){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a}else c=!0;if(c){if(void 0!==e.commonjs2){const t=a;if("string"!=typeof e.commonjs2){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a}else c=!0;if(c)if(void 0!==e.root){const t=a;if("string"!=typeof e.root){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}c=t===a}else c=!0}}}}else{const e={params:{type:"object"}};null===o?o=[e]:o.push(e),a++}u=t===a,l=l||u}if(!l){const e={params:{}};return null===o?o=[e]:o.push(e),a++,p.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),p.errors=o,0===a}function f(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;if(a===p)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===o?o=[e]:o.push(e),a++}else{const t=e.length;for(let n=0;n1){const r={};for(;n--;){let s=t[n];if("string"==typeof s){if("number"==typeof r[s]){e=r[s];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[s]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var g=o===f;if(s=s||g,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}g=e===f,s=s||g}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h){if(void 0!==e.filename){const n=f;l(e.filename,{instancePath:t+"/filename",parentData:e,parentDataProperty:"filename",rootData:o})||(p=null===p?l.errors:p.concat(l.errors),f=p.length),h=n===f}else h=!0;if(h){if(void 0!==e.import){let t=e.import;const n=f,r=f;let s=!1;const o=f;if(f===o)if(Array.isArray(t))if(t.length<1){const e={params:{limit:1}};null===p?p=[e]:p.push(e),f++}else{var b=!0;const e=t.length;for(let n=0;n1){const r={};for(;n--;){let s=t[n];if("string"==typeof s){if("number"==typeof r[s]){e=r[s];const t={params:{i:n,j:e}};null===p?p=[t]:p.push(t),f++;break}r[s]=n}}}}}else{const e={params:{type:"array"}};null===p?p=[e]:p.push(e),f++}var v=o===f;if(s=s||v,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=e===f,s=s||v}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h){if(void 0!==e.layer){let t=e.layer;const n=f,r=f;let s=!1;const o=f;if(null!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var D=o===f;if(s=s||D,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}D=e===f,s=s||D}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h){if(void 0!==e.library){const n=f;u(e.library,{instancePath:t+"/library",parentData:e,parentDataProperty:"library",rootData:o})||(p=null===p?u.errors:p.concat(u.errors),f=p.length),h=n===f}else h=!0;if(h){if(void 0!==e.publicPath){const n=f;c(e.publicPath,{instancePath:t+"/publicPath",parentData:e,parentDataProperty:"publicPath",rootData:o})||(p=null===p?c.errors:p.concat(c.errors),f=p.length),h=n===f}else h=!0;if(h){if(void 0!==e.runtime){let t=e.runtime;const n=f,r=f;let s=!1;const o=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=o===f;if(s=s||P,!s){const e=f;if(f===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=e===f,s=s||P}if(!s){const e={params:{}};return null===p?p=[e]:p.push(e),f++,m.errors=p,!1}f=r,null!==p&&(r?p.length=r:p=null),h=n===f}else h=!0;if(h)if(void 0!==e.wasmLoading){const n=f;y(e.wasmLoading,{instancePath:t+"/wasmLoading",parentData:e,parentDataProperty:"wasmLoading",rootData:o})||(p=null===p?y.errors:p.concat(y.errors),f=p.length),h=n===f}else h=!0}}}}}}}}}}}return m.errors=p,0===f}function h(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;if(0===a){if(!e||"object"!=typeof e||Array.isArray(e))return h.errors=[{params:{type:"object"}}],!1;for(const n in e){let r=e[n];const f=a,u=a;let c=!1;const y=a,d=a;let g=!1;const b=a;if(a===b)if(Array.isArray(r))if(r.length<1){const e={params:{limit:1}};null===o?o=[e]:o.push(e),a++}else{var i=!0;const e=r.length;for(let t=0;t1){const n={};for(;t--;){let s=r[t];if("string"==typeof s){if("number"==typeof n[s]){e=n[s];const r={params:{i:t,j:e}};null===o?o=[r]:o.push(r),a++;break}n[s]=t}}}}}else{const e={params:{type:"array"}};null===o?o=[e]:o.push(e),a++}var l=b===a;if(g=g||l,!g){const e=a;if(a===e)if("string"==typeof r){if(r.length<1){const e={params:{}};null===o?o=[e]:o.push(e),a++}}else{const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}l=e===a,g=g||l}if(g)a=d,null!==o&&(d?o.length=d:o=null);else{const e={params:{}};null===o?o=[e]:o.push(e),a++}var p=y===a;if(c=c||p,!c){const i=a;m(r,{instancePath:t+"/"+n.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:n,rootData:s})||(o=null===o?m.errors:o.concat(m.errors),a=o.length),p=i===a,c=c||p}if(!c){const e={params:{}};return null===o?o=[e]:o.push(e),a++,h.errors=o,!1}if(a=u,null!==o&&(u?o.length=u:o=null),f!==a)break}}return h.errors=o,0===a}function d(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1,p=null;const f=a,u=a;let c=!1;const y=a;if(a===y)if(Array.isArray(e))if(e.length<1){const e={params:{limit:1}};null===o?o=[e]:o.push(e),a++}else{var m=!0;const t=e.length;for(let n=0;n1){const r={};for(;n--;){let s=e[n];if("string"==typeof s){if("number"==typeof r[s]){t=r[s];const e={params:{i:n,j:t}};null===o?o=[e]:o.push(e),a++;break}r[s]=n}}}}}else{const e={params:{type:"array"}};null===o?o=[e]:o.push(e),a++}var h=y===a;if(c=c||h,!c){const t=a;if(a===t)if("string"==typeof e){if(e.length<1){const e={params:{}};null===o?o=[e]:o.push(e),a++}}else{const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}h=t===a,c=c||h}if(c)a=u,null!==o&&(u?o.length=u:o=null);else{const e={params:{}};null===o?o=[e]:o.push(e),a++}if(f===a&&(l=!0,p=0),!l){const e={params:{passingSchemas:p}};return null===o?o=[e]:o.push(e),a++,d.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),d.errors=o,0===a}function g(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;h(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:s})||(o=null===o?h.errors:o.concat(h.errors),a=o.length);var f=p===a;if(l=l||f,!l){const i=a;d(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:s})||(o=null===o?d.errors:o.concat(d.errors),a=o.length),f=i===a,l=l||f}if(!l){const e={params:{}};return null===o?o=[e]:o.push(e),a++,g.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),g.errors=o,0===a}function b(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;if(!(e instanceof Function)){const e={params:{}};null===o?o=[e]:o.push(e),a++}var f=p===a;if(l=l||f,!l){const i=a;g(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:s})||(o=null===o?g.errors:o.concat(g.errors),a=o.length),f=i===a,l=l||f}if(!l){const e={params:{}};return null===o?o=[e]:o.push(e),a++,b.errors=o,!1}return a=i,null!==o&&(i?o.length=i:o=null),b.errors=o,0===a}const v={asset:{type:"boolean"},asyncWebAssembly:{type:"boolean"},buildHttp:{anyOf:[{type:"boolean"},{$ref:"#/definitions/HttpUriOptions"}]},cacheUnaffected:{type:"boolean"},futureDefaults:{type:"boolean"},layers:{type:"boolean"},lazyCompilation:{anyOf:[{type:"boolean"},{type:"object",additionalProperties:!1,properties:{backend:{instanceof:"Function"},client:{type:"string"},entries:{type:"boolean"},imports:{type:"boolean"},test:{anyOf:[{instanceof:"RegExp"},{type:"string"},{instanceof:"Function"}]}}}]},outputModule:{type:"boolean"},syncWebAssembly:{type:"boolean"},topLevelAwait:{type:"boolean"}};function D(t,{instancePath:r="",parentData:s,parentDataProperty:o,rootData:a=t}={}){let i=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return D.errors=[{params:{type:"object"}}],!1;{const r=l;for(const e in t)if(!n.call(v,e))return D.errors=[{params:{additionalProperty:e}}],!1;if(r===l){if(void 0!==t.asset){const e=l;if("boolean"!=typeof t.asset)return D.errors=[{params:{type:"boolean"}}],!1;var p=e===l}else p=!0;if(p){if(void 0!==t.asyncWebAssembly){const e=l;if("boolean"!=typeof t.asyncWebAssembly)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.buildHttp){let n=t.buildHttp;const r=l,s=l;let o=!1;const a=l;if("boolean"!=typeof n){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}var f=a===l;if(o=o||f,!o){const t=l;if(l==l)if(n&&"object"==typeof n&&!Array.isArray(n)){const t=l;for(const e in n)if("cacheLocation"!==e&&"frozen"!==e&&"lockfileLocation"!==e&&"upgrade"!==e){const t={params:{additionalProperty:e}};null===i?i=[t]:i.push(t),l++;break}if(t===l){if(void 0!==n.cacheLocation){let t=n.cacheLocation;const r=l,s=l;let o=!1;const a=l;if(!1!==t){const e={params:{}};null===i?i=[e]:i.push(e),l++}var u=a===l;if(o=o||u,!o){const n=l;if(l===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}u=n===l,o=o||u}if(o)l=s,null!==i&&(s?i.length=s:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}var c=r===l}else c=!0;if(c){if(void 0!==n.frozen){const e=l;if("boolean"!=typeof n.frozen){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}c=e===l}else c=!0;if(c){if(void 0!==n.lockfileLocation){let t=n.lockfileLocation;const r=l;if(l===r)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}c=r===l}else c=!0;if(c)if(void 0!==n.upgrade){const e=l;if("boolean"!=typeof n.upgrade){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}c=e===l}else c=!0}}}}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}f=t===l,o=o||f}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),l++,D.errors=i,!1}l=s,null!==i&&(s?i.length=s:i=null),p=r===l}else p=!0;if(p){if(void 0!==t.cacheUnaffected){const e=l;if("boolean"!=typeof t.cacheUnaffected)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.futureDefaults){const e=l;if("boolean"!=typeof t.futureDefaults)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.layers){const e=l;if("boolean"!=typeof t.layers)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.lazyCompilation){let e=t.lazyCompilation;const n=l,r=l;let s=!1;const o=l;if("boolean"!=typeof e){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}var y=o===l;if(s=s||y,!s){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=l;for(const t in e)if("backend"!==t&&"client"!==t&&"entries"!==t&&"imports"!==t&&"test"!==t){const e={params:{additionalProperty:t}};null===i?i=[e]:i.push(e),l++;break}if(t===l){if(void 0!==e.backend){const t=l;if(!(e.backend instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var m=t===l}else m=!0;if(m){if(void 0!==e.client){const t=l;if("string"!=typeof e.client){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}m=t===l}else m=!0;if(m){if(void 0!==e.entries){const t=l;if("boolean"!=typeof e.entries){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}m=t===l}else m=!0;if(m){if(void 0!==e.imports){const t=l;if("boolean"!=typeof e.imports){const e={params:{type:"boolean"}};null===i?i=[e]:i.push(e),l++}m=t===l}else m=!0;if(m)if(void 0!==e.test){let t=e.test;const n=l,r=l;let s=!1;const o=l;if(!(t instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var h=o===l;if(s=s||h,!s){const e=l;if("string"!=typeof t){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(h=e===l,s=s||h,!s){const e=l;if(!(t instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}h=e===l,s=s||h}}if(s)l=r,null!==i&&(r?i.length=r:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}m=n===l}else m=!0}}}}}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}y=t===l,s=s||y}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,D.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.outputModule){const e=l;if("boolean"!=typeof t.outputModule)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.syncWebAssembly){const e=l;if("boolean"!=typeof t.syncWebAssembly)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p)if(void 0!==t.topLevelAwait){const e=l;if("boolean"!=typeof t.topLevelAwait)return D.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}return D.errors=i,0===l}const P={validate:A};function A(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:s=e}={}){let o=null,a=0;const i=a;let l=!1;const p=a;if(!(e instanceof RegExp)){const e={params:{}};null===o?o=[e]:o.push(e),a++}var f=p===a;if(l=l||f,!l){const n=a;if("string"!=typeof e){const e={params:{type:"string"}};null===o?o=[e]:o.push(e),a++}if(f=n===a,l=l||f,!l){const n=a;if(a===n)if(e&&"object"==typeof e&&!Array.isArray(e)){const n=a;for(const t in e)if("byLayer"!==t){let n=e[t];const r=a,s=a;let i=!1;const l=a;if(a===l)if(Array.isArray(n)){const e=n.length;for(let t=0;t=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var u=y===l;if(c=c||u,!c){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}u=t===l,c=c||u}if(c)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,s=l;let o=!1;const a=l;if(l===a)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===i?i=[e]:i.push(e),l++}else if(n.length<1){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}var c=a===l;if(o=o||c,!o){const e=l;if(!(n instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}c=e===l,o=o||c}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=s,null!==i&&(s?i.length=s:i=null),p=r===l}else p=!0;if(p){if(void 0!==t.idHint){const e=l;if("string"!=typeof t.idHint)return oe.errors=[{params:{type:"string"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.layer){let e=t.layer;const n=l,r=l;let s=!1;const o=l;if(!(e instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var y=o===l;if(s=s||y,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(y=t===l,s=s||y,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}y=t===l,s=s||y}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var m=c===l;if(u=u||m,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}m=t===l,u=u||m}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var h=c===l;if(u=u||h,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}h=t===l,u=u||h}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var d=c===l;if(u=u||d,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}d=t===l,u=u||d}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return oe.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var g=c===l;if(u=u||g,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}g=t===l,u=u||g}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var b=c===l;if(u=u||b,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}b=t===l,u=u||b}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let s=!1;const o=l;if(!1!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var v=o===l;if(s=s||v,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(v=t===l,s=s||v,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}v=t===l,s=s||v}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.priority){let e=t.priority;const n=l;if("number"!=typeof e||!isFinite(e))return oe.errors=[{params:{type:"number"}}],!1;p=n===l}else p=!0;if(p){if(void 0!==t.reuseExistingChunk){const e=l;if("boolean"!=typeof t.reuseExistingChunk)return oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.test){let e=t.test;const n=l,r=l;let s=!1;const o=l;if(!(e instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var D=o===l;if(s=s||D,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(D=t===l,s=s||D,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}D=t===l,s=s||D}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.type){let e=t.type;const n=l,r=l;let s=!1;const o=l;if(!(e instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}var P=o===l;if(s=s||P,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(P=t===l,s=s||P,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}P=t===l,s=s||P}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,oe.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return oe.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}}}}return oe.errors=i,0===l}function ae(t,{instancePath:r="",parentData:s,parentDataProperty:o,rootData:a=t}={}){let i=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return ae.errors=[{params:{type:"object"}}],!1;{const s=l;for(const e in t)if(!n.call(re,e))return ae.errors=[{params:{additionalProperty:e}}],!1;if(s===l){if(void 0!==t.automaticNameDelimiter){let e=t.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof e)return ae.errors=[{params:{type:"string"}}],!1;if(e.length<1)return ae.errors=[{params:{}}],!1}var p=n===l}else p=!0;if(p){if(void 0!==t.cacheGroups){let e=t.cacheGroups;const n=l,s=l,o=l;if(l===o)if(e&&"object"==typeof e&&!Array.isArray(e)){let t;if(void 0===e.test&&(t="test")){const e={};null===i?i=[e]:i.push(e),l++}else if(void 0!==e.test){let t=e.test;const n=l;let r=!1;const s=l;if(!(t instanceof RegExp)){const e={};null===i?i=[e]:i.push(e),l++}var f=s===l;if(r=r||f,!r){const e=l;if("string"!=typeof t){const e={};null===i?i=[e]:i.push(e),l++}if(f=e===l,r=r||f,!r){const e=l;if(!(t instanceof Function)){const e={};null===i?i=[e]:i.push(e),l++}f=e===l,r=r||f}}if(r)l=n,null!==i&&(n?i.length=n:i=null);else{const e={};null===i?i=[e]:i.push(e),l++}}}else{const e={};null===i?i=[e]:i.push(e),l++}if(o===l)return ae.errors=[{params:{}}],!1;if(l=s,null!==i&&(s?i.length=s:i=null),l===n){if(!e||"object"!=typeof e||Array.isArray(e))return ae.errors=[{params:{type:"object"}}],!1;for(const t in e){let n=e[t];const s=l,o=l;let p=!1;const f=l;if(!1!==n){const e={params:{}};null===i?i=[e]:i.push(e),l++}var u=f===l;if(p=p||u,!p){const s=l;if(!(n instanceof RegExp)){const e={params:{}};null===i?i=[e]:i.push(e),l++}if(u=s===l,p=p||u,!p){const s=l;if("string"!=typeof n){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(u=s===l,p=p||u,!p){const s=l;if(!(n instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}if(u=s===l,p=p||u,!p){const s=l;oe(n,{instancePath:r+"/cacheGroups/"+t.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:e,parentDataProperty:t,rootData:a})||(i=null===i?oe.errors:i.concat(oe.errors),l=i.length),u=s===l,p=p||u}}}}if(!p){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}if(l=o,null!==i&&(o?i.length=o:i=null),s!==l)break}}p=n===l}else p=!0;if(p){if(void 0!==t.chunks){let e=t.chunks;const n=l,r=l;let s=!1;const o=l;if("initial"!==e&&"async"!==e&&"all"!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var c=o===l;if(s=s||c,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}c=t===l,s=s||c}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.defaultSizeTypes){let e=t.defaultSizeTypes;const n=l;if(l===n){if(!Array.isArray(e))return ae.errors=[{params:{type:"array"}}],!1;if(e.length<1)return ae.errors=[{params:{limit:1}}],!1;{const t=e.length;for(let n=0;n=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var y=c===l;if(u=u||y,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}y=t===l,u=u||y}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.fallbackCacheGroup){let e=t.fallbackCacheGroup;const n=l;if(l===n){if(!e||"object"!=typeof e||Array.isArray(e))return ae.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in e)if("automaticNameDelimiter"!==t&&"maxAsyncSize"!==t&&"maxInitialSize"!==t&&"maxSize"!==t&&"minSize"!==t)return ae.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==e.automaticNameDelimiter){let t=e.automaticNameDelimiter;const n=l;if(l===n){if("string"!=typeof t)return ae.errors=[{params:{type:"string"}}],!1;if(t.length<1)return ae.errors=[{params:{}}],!1}var m=n===l}else m=!0;if(m){if(void 0!==e.maxAsyncSize){let t=e.maxAsyncSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var h=u===l;if(f=f||h,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}h=e===l,f=f||h}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxInitialSize){let t=e.maxInitialSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var d=u===l;if(f=f||d,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}d=e===l,f=f||d}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0;if(m){if(void 0!==e.maxSize){let t=e.maxSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var g=u===l;if(f=f||g,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}g=e===l,f=f||g}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0;if(m)if(void 0!==e.minSize){let t=e.minSize;const n=l,r=l;let s=!1,o=null;const a=l,p=l;let f=!1;const u=l;if(l===u)if("number"==typeof t&&isFinite(t)){if(t<0||isNaN(t)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var b=u===l;if(f=f||b,!f){const e=l;if(l===e)if(t&&"object"==typeof t&&!Array.isArray(t))for(const e in t){let n=t[e];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}b=e===l,f=f||b}if(f)l=p,null!==i&&(p?i.length=p:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),m=n===l}else m=!0}}}}}}p=n===l}else p=!0;if(p){if(void 0!==t.filename){let n=t.filename;const r=l,s=l;let o=!1;const a=l;if(l===a)if("string"==typeof n){if(n.includes("!")||!1!==e.test(n)){const e={params:{}};null===i?i=[e]:i.push(e),l++}else if(n.length<1){const e={params:{}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}var v=a===l;if(o=o||v,!o){const e=l;if(!(n instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}v=e===l,o=o||v}if(!o){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=s,null!==i&&(s?i.length=s:i=null),p=r===l}else p=!0;if(p){if(void 0!==t.hidePathInfo){const e=l;if("boolean"!=typeof t.hidePathInfo)return ae.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0;if(p){if(void 0!==t.maxAsyncRequests){let e=t.maxAsyncRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return ae.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ae.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxAsyncSize){let e=t.maxAsyncSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var D=c===l;if(u=u||D,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}D=t===l,u=u||D}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialRequests){let e=t.maxInitialRequests;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return ae.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ae.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.maxInitialSize){let e=t.maxInitialSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var P=c===l;if(u=u||P,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}P=t===l,u=u||P}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.maxSize){let e=t.maxSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var A=c===l;if(u=u||A,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}A=t===l,u=u||A}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minChunks){let e=t.minChunks;const n=l;if(l===n){if("number"!=typeof e||!isFinite(e))return ae.errors=[{params:{type:"number"}}],!1;if(e<1||isNaN(e))return ae.errors=[{params:{comparison:">=",limit:1}}],!1}p=n===l}else p=!0;if(p){if(void 0!==t.minRemainingSize){let e=t.minRemainingSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var x=c===l;if(u=u||x,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}x=t===l,u=u||x}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.minSize){let e=t.minSize;const n=l,r=l;let s=!1,o=null;const a=l,f=l;let u=!1;const c=l;if(l===c)if("number"==typeof e&&isFinite(e)){if(e<0||isNaN(e)){const e={params:{comparison:">=",limit:0}};null===i?i=[e]:i.push(e),l++}}else{const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}var k=c===l;if(u=u||k,!u){const t=l;if(l===t)if(e&&"object"==typeof e&&!Array.isArray(e))for(const t in e){let n=e[t];const r=l;if("number"!=typeof n||!isFinite(n)){const e={params:{type:"number"}};null===i?i=[e]:i.push(e),l++}if(r!==l)break}else{const e={params:{type:"object"}};null===i?i=[e]:i.push(e),l++}k=t===l,u=u||k}if(u)l=f,null!==i&&(f?i.length=f:i=null);else{const e={params:{}};null===i?i=[e]:i.push(e),l++}if(a===l&&(s=!0,o=0),!s){const e={params:{passingSchemas:o}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p){if(void 0!==t.name){let e=t.name;const n=l,r=l;let s=!1;const o=l;if(!1!==e){const e={params:{}};null===i?i=[e]:i.push(e),l++}var j=o===l;if(s=s||j,!s){const t=l;if("string"!=typeof e){const e={params:{type:"string"}};null===i?i=[e]:i.push(e),l++}if(j=t===l,s=s||j,!s){const t=l;if(!(e instanceof Function)){const e={params:{}};null===i?i=[e]:i.push(e),l++}j=t===l,s=s||j}}if(!s){const e={params:{}};return null===i?i=[e]:i.push(e),l++,ae.errors=i,!1}l=r,null!==i&&(r?i.length=r:i=null),p=n===l}else p=!0;if(p)if(void 0!==t.usedExports){const e=l;if("boolean"!=typeof t.usedExports)return ae.errors=[{params:{type:"boolean"}}],!1;p=e===l}else p=!0}}}}}}}}}}}}}}}}}}}return ae.errors=i,0===l}function ie(e,{instancePath:t="",parentData:r,parentDataProperty:s,rootData:o=e}={}){let a=null,i=0;if(0===i){if(!e||"object"!=typeof e||Array.isArray(e))return ie.errors=[{params:{type:"object"}}],!1;{const r=i;for(const t in e)if(!n.call(ne,t))return ie.errors=[{params:{additionalProperty:t}}],!1;if(r===i){if(void 0!==e.checkWasmTypes){const t=i;if("boolean"!=typeof e.checkWasmTypes)return ie.errors=[{params:{type:"boolean"}}],!1;var l=t===i}else l=!0;if(l){if(void 0!==e.chunkIds){let t=e.chunkIds;const n=i;if("natural"!==t&&"named"!==t&&"deterministic"!==t&&"size"!==t&&"total-size"!==t&&!1!==t)return ie.errors=[{params:{}}],!1;l=n===i}else l=!0;if(l){if(void 0!==e.concatenateModules){const t=i;if("boolean"!=typeof e.concatenateModules)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.emitOnErrors){const t=i;if("boolean"!=typeof e.emitOnErrors)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.flagIncludedChunks){const t=i;if("boolean"!=typeof e.flagIncludedChunks)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.innerGraph){const t=i;if("boolean"!=typeof e.innerGraph)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.mangleExports){let t=e.mangleExports;const n=i,r=i;let s=!1;const o=i;if("size"!==t&&"deterministic"!==t){const e={params:{}};null===a?a=[e]:a.push(e),i++}var p=o===i;if(s=s||p,!s){const e=i;if("boolean"!=typeof t){const e={params:{type:"boolean"}};null===a?a=[e]:a.push(e),i++}p=e===i,s=s||p}if(!s){const e={params:{}};return null===a?a=[e]:a.push(e),i++,ie.errors=a,!1}i=r,null!==a&&(r?a.length=r:a=null),l=n===i}else l=!0;if(l){if(void 0!==e.mangleWasmImports){const t=i;if("boolean"!=typeof e.mangleWasmImports)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.mergeDuplicateChunks){const t=i;if("boolean"!=typeof e.mergeDuplicateChunks)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.minimize){const t=i;if("boolean"!=typeof e.minimize)return ie.errors=[{params:{type:"boolean"}}],!1;l=t===i}else l=!0;if(l){if(void 0!==e.minimizer){let t=e.minimizer;const n=i;if(i===n){if(!Array.isArray(t))return ie.errors=[{params:{type:"array"}}],!1;{const e=t.length;for(let n=0;n=",limit:1}}],!1}m=n===f}else m=!0;if(m){if(void 0!==t.hashFunction){let e=t.hashFunction;const n=f,r=f;let s=!1;const o=f;if(f===o)if("string"==typeof e){if(e.length<1){const e={params:{}};null===l?l=[e]:l.push(e),f++}}else{const e={params:{type:"string"}};null===l?l=[e]:l.push(e),f++}var v=o===f;if(s=s||v,!s){const t=f;if(!(e instanceof Function)){const e={params:{}};null===l?l=[e]:l.push(e),f++}v=t===f,s=s||v}if(!s){const e={params:{}};return null===l?l=[e]:l.push(e),f++,de.errors=l,!1}f=r,null!==l&&(r?l.length=r:l=null),m=n===f}else m=!0;if(m){if(void 0!==t.hashSalt){let e=t.hashSalt;const n=f;if(f==f){if("string"!=typeof e)return de.errors=[{params:{type:"string"}}],!1;if(e.length<1)return de.errors=[{params:{}}],!1}m=n===f}else m=!0;if(m){if(void 0!==t.hotUpdateChunkFilename){let n=t.hotUpdateChunkFilename;const r=f;if(f==f){if("string"!=typeof n)return de.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return de.errors=[{params:{}}],!1}m=r===f}else m=!0;if(m){if(void 0!==t.hotUpdateGlobal){const e=f;if("string"!=typeof t.hotUpdateGlobal)return de.errors=[{params:{type:"string"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.hotUpdateMainFilename){let n=t.hotUpdateMainFilename;const r=f;if(f==f){if("string"!=typeof n)return de.errors=[{params:{type:"string"}}],!1;if(n.includes("!")||!1!==e.test(n))return de.errors=[{params:{}}],!1}m=r===f}else m=!0;if(m){if(void 0!==t.iife){const e=f;if("boolean"!=typeof t.iife)return de.errors=[{params:{type:"boolean"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.importFunctionName){const e=f;if("string"!=typeof t.importFunctionName)return de.errors=[{params:{type:"string"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.importMetaName){const e=f;if("string"!=typeof t.importMetaName)return de.errors=[{params:{type:"string"}}],!1;m=e===f}else m=!0;if(m){if(void 0!==t.library){const e=f;he(t.library,{instancePath:r+"/library",parentData:t,parentDataProperty:"library",rootData:a})||(l=null===l?he.errors:l.concat(he.errors),f=l.length),m=e===f}else m=!0;if(m){if(void 0!==t.libraryExport){let e=t.libraryExport;const n=f,r=f;let s=!1,o=null;const a=f,i=f;let p=!1;const u=f;if(f===u)if(Array.isArray(e)){const t=e.length;for(let n=0;n=",limit:1}}],!1}c=t===f}else c=!0;if(c){if(void 0!==r.performance){const e=f;ge(r.performance,{instancePath:s+"/performance",parentData:r,parentDataProperty:"performance",rootData:l})||(p=null===p?ge.errors:p.concat(ge.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.plugins){const e=f;be(r.plugins,{instancePath:s+"/plugins",parentData:r,parentDataProperty:"plugins",rootData:l})||(p=null===p?be.errors:p.concat(be.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.profile){const e=f;if("boolean"!=typeof r.profile)return Fe.errors=[{params:{type:"boolean"}}],!1;c=e===f}else c=!0;if(c){if(void 0!==r.recordsInputPath){let t=r.recordsInputPath;const n=f,s=f;let o=!1;const a=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var g=a===f;if(o=o||g,!o){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}g=n===f,o=o||g}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,Fe.errors=p,!1}f=s,null!==p&&(s?p.length=s:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsOutputPath){let t=r.recordsOutputPath;const n=f,s=f;let o=!1;const a=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var v=a===f;if(o=o||v,!o){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}v=n===f,o=o||v}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,Fe.errors=p,!1}f=s,null!==p&&(s?p.length=s:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.recordsPath){let t=r.recordsPath;const n=f,s=f;let o=!1;const a=f;if(!1!==t){const e={params:{}};null===p?p=[e]:p.push(e),f++}var P=a===f;if(o=o||P,!o){const n=f;if(f===n)if("string"==typeof t){if(t.includes("!")||!0!==e.test(t)){const e={params:{}};null===p?p=[e]:p.push(e),f++}}else{const e={params:{type:"string"}};null===p?p=[e]:p.push(e),f++}P=n===f,o=o||P}if(!o){const e={params:{}};return null===p?p=[e]:p.push(e),f++,Fe.errors=p,!1}f=s,null!==p&&(s?p.length=s:p=null),c=n===f}else c=!0;if(c){if(void 0!==r.resolve){const e=f;ve(r.resolve,{instancePath:s+"/resolve",parentData:r,parentDataProperty:"resolve",rootData:l})||(p=null===p?ve.errors:p.concat(ve.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.resolveLoader){const e=f;De(r.resolveLoader,{instancePath:s+"/resolveLoader",parentData:r,parentDataProperty:"resolveLoader",rootData:l})||(p=null===p?De.errors:p.concat(De.errors),f=p.length),c=e===f}else c=!0;if(c){if(void 0!==r.snapshot){let t=r.snapshot;const n=f;if(f==f){if(!t||"object"!=typeof t||Array.isArray(t))return Fe.errors=[{params:{type:"object"}}],!1;{const n=f;for(const e in t)if("buildDependencies"!==e&&"immutablePaths"!==e&&"managedPaths"!==e&&"module"!==e&&"resolve"!==e&&"resolveBuildDependencies"!==e)return Fe.errors=[{params:{additionalProperty:e}}],!1;if(n===f){if(void 0!==t.buildDependencies){let e=t.buildDependencies;const n=f;if(f===n){if(!e||"object"!=typeof e||Array.isArray(e))return Fe.errors=[{params:{type:"object"}}],!1;{const t=f;for(const t in e)if("hash"!==t&&"timestamp"!==t)return Fe.errors=[{params:{additionalProperty:t}}],!1;if(t===f){if(void 0!==e.hash){const t=f;if("boolean"!=typeof e.hash)return Fe.errors=[{params:{type:"boolean"}}],!1;var A=t===f}else A=!0;if(A)if(void 0!==e.timestamp){const t=f;if("boolean"!=typeof e.timestamp)return Fe.errors=[{params:{type:"boolean"}}],!1;A=t===f}else A=!0}}}var k=n===f}else k=!0;if(k){if(void 0!==t.immutablePaths){let n=t.immutablePaths;const r=f;if(f===r){if(!Array.isArray(n))return Fe.errors=[{params:{type:"array"}}],!1;{const t=n.length;for(let r=0;r e.toMatchInlineSnapshot(` - - Expected - + Received +- Expected ++ Received - @@ ... @@ - - "cache": false, - + "cache": Object { - + "maxGenerations": Infinity, - + "type": "memory", - + }, - @@ ... @@ - - "devtool": false, - + "devtool": "eval", - @@ ... @@ - - "mode": "none", - + "mode": "development", - @@ ... @@ - - "unsafeCache": false, - + "unsafeCache": [Function anonymous], - @@ ... @@ - - "chunkIds": "natural", - + "chunkIds": "named", - @@ ... @@ - - "moduleIds": "natural", - - "nodeEnv": false, - + "moduleIds": "named", - + "nodeEnv": "development", - @@ ... @@ - - "minRemainingSize": undefined, - + "minRemainingSize": 0, - @@ ... @@ - - "pathinfo": false, - + "pathinfo": true, - @@ ... @@ - - "cache": false, - + "cache": true, - @@ ... @@ - - "production", - + "development", - @@ ... @@ - - "cache": false, - + "cache": true, - `) +@@ ... @@ +- "cache": false, ++ "cache": Object { ++ "cacheUnaffected": false, ++ "maxGenerations": Infinity, ++ "type": "memory", ++ }, +@@ ... @@ +- "devtool": false, ++ "devtool": "eval", +@@ ... @@ +- "mode": "none", ++ "mode": "development", +@@ ... @@ +- "unsafeCache": false, ++ "unsafeCache": [Function anonymous], +@@ ... @@ +- "chunkIds": "natural", ++ "chunkIds": "named", +@@ ... @@ +- "moduleIds": "natural", +- "nodeEnv": false, ++ "moduleIds": "named", ++ "nodeEnv": "development", +@@ ... @@ +- "minRemainingSize": undefined, ++ "minRemainingSize": 0, +@@ ... @@ +- "pathinfo": false, ++ "pathinfo": true, +@@ ... @@ +- "cache": false, ++ "cache": true, +@@ ... @@ +- "production", ++ "development", +@@ ... @@ +- "cache": false, ++ "cache": true, +`) ); test("sync wasm", { experiments: { syncWebAssembly: true } }, e => e.toMatchInlineSnapshot(` @@ -1480,25 +1482,26 @@ Object { ); test("cache true", { cache: true }, e => e.toMatchInlineSnapshot(` - - Expected - + Received +- Expected ++ Received - @@ ... @@ - - "cache": false, - + "cache": Object { - + "maxGenerations": Infinity, - + "type": "memory", - + }, - @@ ... @@ - - "unsafeCache": false, - + "unsafeCache": [Function anonymous], - @@ ... @@ - - "cache": false, - + "cache": true, - @@ ... @@ - - "cache": false, - + "cache": true, - `) +@@ ... @@ +- "cache": false, ++ "cache": Object { ++ "cacheUnaffected": false, ++ "maxGenerations": Infinity, ++ "type": "memory", ++ }, +@@ ... @@ +- "unsafeCache": false, ++ "unsafeCache": [Function anonymous], +@@ ... @@ +- "cache": false, ++ "cache": true, +@@ ... @@ +- "cache": false, ++ "cache": true, +`) ); test("cache filesystem", { cache: { type: "filesystem" } }, e => e.toMatchInlineSnapshot(` @@ -1523,6 +1526,7 @@ Object { + "idleTimeoutForInitialStore": 5000, + "maxAge": 5184000000, + "maxMemoryGenerations": Infinity, ++ "memoryCacheUnaffected": false, + "name": "default-none", + "profile": false, + "store": "pack", @@ -1545,66 +1549,67 @@ Object { { mode: "development", cache: { type: "filesystem" } }, e => e.toMatchInlineSnapshot(` - - Expected - + Received +- Expected ++ Received - @@ ... @@ - - "cache": false, - + "cache": Object { - + "allowCollectingMemory": true, - + "buildDependencies": Object { - + "defaultWebpack": Array [ - + "/lib/", - + ], - + }, - + "cacheDirectory": "/node_modules/.cache/webpack", - + "cacheLocation": "/node_modules/.cache/webpack/default-development", - + "compression": false, - + "hashAlgorithm": "md4", - + "idleTimeout": 60000, - + "idleTimeoutAfterLargeChanges": 1000, - + "idleTimeoutForInitialStore": 5000, - + "maxAge": 5184000000, - + "maxMemoryGenerations": 5, - + "name": "default-development", - + "profile": false, - + "store": "pack", - + "type": "filesystem", - + "version": "", - + }, - @@ ... @@ - - "devtool": false, - + "devtool": "eval", - @@ ... @@ - - "mode": "none", - + "mode": "development", - @@ ... @@ - - "unsafeCache": false, - + "unsafeCache": [Function anonymous], - @@ ... @@ - - "chunkIds": "natural", - + "chunkIds": "named", - @@ ... @@ - - "moduleIds": "natural", - - "nodeEnv": false, - + "moduleIds": "named", - + "nodeEnv": "development", - @@ ... @@ - - "minRemainingSize": undefined, - + "minRemainingSize": 0, - @@ ... @@ - - "pathinfo": false, - + "pathinfo": true, - @@ ... @@ - - "cache": false, - + "cache": true, - @@ ... @@ - - "production", - + "development", - @@ ... @@ - - "cache": false, - + "cache": true, - `) +@@ ... @@ +- "cache": false, ++ "cache": Object { ++ "allowCollectingMemory": true, ++ "buildDependencies": Object { ++ "defaultWebpack": Array [ ++ "/lib/", ++ ], ++ }, ++ "cacheDirectory": "/node_modules/.cache/webpack", ++ "cacheLocation": "/node_modules/.cache/webpack/default-development", ++ "compression": false, ++ "hashAlgorithm": "md4", ++ "idleTimeout": 60000, ++ "idleTimeoutAfterLargeChanges": 1000, ++ "idleTimeoutForInitialStore": 5000, ++ "maxAge": 5184000000, ++ "maxMemoryGenerations": 5, ++ "memoryCacheUnaffected": false, ++ "name": "default-development", ++ "profile": false, ++ "store": "pack", ++ "type": "filesystem", ++ "version": "", ++ }, +@@ ... @@ +- "devtool": false, ++ "devtool": "eval", +@@ ... @@ +- "mode": "none", ++ "mode": "development", +@@ ... @@ +- "unsafeCache": false, ++ "unsafeCache": [Function anonymous], +@@ ... @@ +- "chunkIds": "natural", ++ "chunkIds": "named", +@@ ... @@ +- "moduleIds": "natural", +- "nodeEnv": false, ++ "moduleIds": "named", ++ "nodeEnv": "development", +@@ ... @@ +- "minRemainingSize": undefined, ++ "minRemainingSize": 0, +@@ ... @@ +- "pathinfo": false, ++ "pathinfo": true, +@@ ... @@ +- "cache": false, ++ "cache": true, +@@ ... @@ +- "production", ++ "development", +@@ ... @@ +- "cache": false, ++ "cache": true, +`) ); test( @@ -1814,6 +1819,7 @@ Object { + "idleTimeoutForInitialStore": 5000, + "maxAge": 5184000000, + "maxMemoryGenerations": Infinity, ++ "memoryCacheUnaffected": false, + "name": "default-none", + "profile": false, + "store": "pack", @@ -1890,7 +1896,9 @@ Object { + Received @@ ... @@ +- "cacheUnaffected": false, - "futureDefaults": false, ++ "cacheUnaffected": true, + "futureDefaults": true, @@ ... @@ - "__dirname": "mock", diff --git a/test/__snapshots__/Cli.test.js.snap b/test/__snapshots__/Cli.test.js.snap index 8a1d0789131..038573fe807 100644 --- a/test/__snapshots__/Cli.test.js.snap +++ b/test/__snapshots__/Cli.test.js.snap @@ -95,6 +95,19 @@ Object { "multiple": false, "simpleType": "string", }, + "cache-cache-unaffected": Object { + "configs": Array [ + Object { + "description": "Additionally cache computation of modules that are unchanged and reference only unchanged modules.", + "multiple": false, + "path": "cache.cacheUnaffected", + "type": "boolean", + }, + ], + "description": "Additionally cache computation of modules that are unchanged and reference only unchanged modules.", + "multiple": false, + "simpleType": "boolean", + }, "cache-compression": Object { "configs": Array [ Object { @@ -256,6 +269,19 @@ Object { "multiple": false, "simpleType": "number", }, + "cache-memory-cache-unaffected": Object { + "configs": Array [ + Object { + "description": "Additionally cache computation of modules that are unchanged and reference only unchanged modules in memory.", + "multiple": false, + "path": "cache.memoryCacheUnaffected", + "type": "boolean", + }, + ], + "description": "Additionally cache computation of modules that are unchanged and reference only unchanged modules in memory.", + "multiple": false, + "simpleType": "boolean", + }, "cache-name": Object { "configs": Array [ Object { @@ -524,6 +550,19 @@ Object { "multiple": false, "simpleType": "boolean", }, + "experiments-cache-unaffected": Object { + "configs": Array [ + Object { + "description": "Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.", + "multiple": false, + "path": "experiments.cacheUnaffected", + "type": "boolean", + }, + ], + "description": "Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.", + "multiple": false, + "simpleType": "boolean", + }, "experiments-future-defaults": Object { "configs": Array [ Object { diff --git a/test/__snapshots__/StatsTestCases.basictest.js.snap b/test/__snapshots__/StatsTestCases.basictest.js.snap index 9f04636053a..b618297515e 100644 --- a/test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/test/__snapshots__/StatsTestCases.basictest.js.snap @@ -1268,15 +1268,15 @@ asset main.js 84 bytes [emitted] (name: ma DEBUG LOG from ./node_modules/custom-loader/index.js Named Logger ./node_modules/custom-loader/index.js!./index.js Message with named logger -LOG from webpack.FlagDependencyExportsPlugin - 0% of exports of modules have been determined (1 no declared exports, 0 not cached, 0 flagged uncacheable, 0 from cache, 0 additional calculations due to dependencies) -+ 3 hidden lines - LOG from webpack.Compilation - 1 modules hashed (1 variants per module in average) + 1 modules hashed, 0 from cache (1 variants per module in average) 100% code generated (1 generated, 0 from cache) NaN% code generated (0 generated, 0 from cache) -+ 19 hidden lines ++ 23 hidden lines + +LOG from webpack.FlagDependencyExportsPlugin + 0% of exports of modules have been determined (1 no declared exports, 0 not cached, 0 flagged uncacheable, 0 from cache, 0 from mem cache, 0 additional calculations due to dependencies) ++ 3 hidden lines LOG from webpack.buildChunkGraph 2 queue items processed (1 blocks) @@ -2057,15 +2057,15 @@ LOG from LogTestPlugin End + 6 hidden lines -LOG from webpack.FlagDependencyExportsPlugin - 0% of exports of modules have been determined (6 no declared exports, 0 not cached, 0 flagged uncacheable, 0 from cache, 0 additional calculations due to dependencies) -+ 3 hidden lines - LOG from webpack.Compilation - 6 modules hashed (1 variants per module in average) + 6 modules hashed, 0 from cache (1 variants per module in average) 100% code generated (6 generated, 0 from cache) 100% code generated (7 generated, 0 from cache) -+ 19 hidden lines ++ 23 hidden lines + +LOG from webpack.FlagDependencyExportsPlugin + 0% of exports of modules have been determined (6 no declared exports, 0 not cached, 0 flagged uncacheable, 0 from cache, 0 from mem cache, 0 additional calculations due to dependencies) ++ 3 hidden lines LOG from webpack.buildChunkGraph 15 queue items processed (9 blocks) @@ -2371,15 +2371,19 @@ LOG from webpack.Compiler LOG from webpack.Compilation finish module profiles: X ms + compute affected modules: X ms finish modules: X ms report dependency errors and warnings: X ms optimize dependencies: X ms create chunks: X ms optimize: X ms - 6 modules hashed (1 variants per module in average) + 6 modules hashed, 0 from cache (1 variants per module in average) module hashing: X ms 100% code generated (6 generated, 0 from cache) code generation: X ms + runtime requirements.modules: X ms + runtime requirements.chunks: X ms + runtime requirements.entries: X ms runtime requirements: X ms hashing: initialize hash: X ms hashing: sort chunks: X ms @@ -2397,7 +2401,7 @@ LOG from webpack.Compilation LOG from webpack.FlagDependencyExportsPlugin restore cached provided exports: X ms figure out provided exports: X ms - 0% of exports of modules have been determined (6 no declared exports, 0 not cached, 0 flagged uncacheable, 0 from cache, 0 additional calculations due to dependencies) + 0% of exports of modules have been determined (6 no declared exports, 0 not cached, 0 flagged uncacheable, 0 from cache, 0 from mem cache, 0 additional calculations due to dependencies) store provided exports into cache: X ms LOG from webpack.InnerGraphPlugin diff --git a/test/watchCases/cache/add-defines/webpack.config.js b/test/watchCases/cache/add-defines/webpack.config.js index b8f22428356..2a062cac437 100644 --- a/test/watchCases/cache/add-defines/webpack.config.js +++ b/test/watchCases/cache/add-defines/webpack.config.js @@ -4,7 +4,8 @@ const currentWatchStep = require("../../../helpers/currentWatchStep"); /** @type {import("../../../../").Configuration} */ module.exports = { cache: { - type: "memory" + type: "memory", + cacheUnaffected: false }, plugins: [ compiler => { diff --git a/types.d.ts b/types.d.ts index 0ce5c2bc86e..50a81734698 100644 --- a/types.d.ts +++ b/types.d.ts @@ -891,7 +891,8 @@ declare class ChunkGraph { addModuleRuntimeRequirements( module: Module, runtime: RuntimeSpec, - items: Set + items: Set, + transferOwnership?: boolean ): void; addChunkRuntimeRequirements(chunk: Chunk, items: Set): void; addTreeRuntimeRequirements(chunk: Chunk, items: Iterable): void; @@ -1458,6 +1459,8 @@ declare class Compilation { chunkTemplate: ChunkTemplate; runtimeTemplate: RuntimeTemplate; moduleTemplates: { javascript: ModuleTemplate }; + memCache?: MemCache; + moduleMemCaches?: WeakMap; moduleGraph: ModuleGraph; chunkGraph: ChunkGraph; codeGenerationResults: CodeGenerationResults; @@ -1594,7 +1597,7 @@ declare class Compilation { reportDependencyErrorsAndWarnings( module: Module, blocks: DependenciesBlock[] - ): void; + ): boolean; codeGeneration(callback?: any): void; processRuntimeRequirements(__0?: { /** @@ -1894,6 +1897,7 @@ declare class Compiler { context: string; requestShortener: RequestShortener; cache: Cache; + moduleMemCaches?: WeakMap; compilerPath: string; running: boolean; idle: boolean; @@ -3282,6 +3286,11 @@ declare interface Experiments { */ buildHttp?: boolean | HttpUriOptions; + /** + * Enable additional in memory caching of modules that are unchanged and reference only unchanged modules. + */ + cacheUnaffected?: boolean; + /** * Apply defaults of next major version. */ @@ -3909,6 +3918,11 @@ declare interface FileCacheOptions { */ maxMemoryGenerations?: number; + /** + * Additionally cache computation of modules that are unchanged and reference only unchanged modules in memory. + */ + memoryCacheUnaffected?: boolean; + /** * Name for the cache. Different names will lead to different coexisting caches. */ @@ -6299,11 +6313,21 @@ declare interface MapOptions { columns?: boolean; module?: boolean; } +declare abstract class MemCache { + get(...args: T): undefined | V; + set(...args: T): void; + provide V)[]], V>(...args: T): V; +} /** * Options object for in-memory caching. */ declare interface MemoryCacheOptions { + /** + * Additionally cache computation of modules that are unchanged and reference only unchanged modules. + */ + cacheUnaffected?: boolean; + /** * Number of generations unused cache entries stay in memory cache at minimum (1 = may be removed after unused for a single compilation, ..., Infinity: kept forever). */ From e5cb12197004af846e81835eaf392cab20439087 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 24 Sep 2021 15:25:48 +0200 Subject: [PATCH 21/34] bump enhanced-resolve in package.json --- package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 01ee0ee60be..838bb183f98 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "acorn-import-assertions": "^1.7.6", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.8.0", + "enhanced-resolve": "^5.8.3", "es-module-lexer": "^0.9.0", "eslint-scope": "5.1.1", "events": "^3.2.0", diff --git a/yarn.lock b/yarn.lock index 1e277e3b22f..048b9490ebd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2242,7 +2242,7 @@ enhanced-resolve@^4.0.0: memory-fs "^0.5.0" tapable "^1.0.0" -enhanced-resolve@^5.8.0: +enhanced-resolve@^5.8.3: version "5.8.3" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz#6d552d465cce0423f5b3d718511ea53826a7b2f0" integrity sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA== From 45829826701ff6582ea16bc36376d105ff264c26 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 24 Sep 2021 21:07:04 +0200 Subject: [PATCH 22/34] 5.54.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3d835e49381..116eb31a07f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack", - "version": "5.53.0", + "version": "5.54.0", "author": "Tobias Koppers @sokra", "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", "license": "MIT", From 51a27fed184439628927b3dd94ffb2e3034dd184 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Sep 2021 02:04:11 +0000 Subject: [PATCH 23/34] chore(deps-dev): bump pretty-format from 27.1.0 to 27.2.2 Bumps [pretty-format](https://github.com/facebook/jest/tree/HEAD/packages/pretty-format) from 27.1.0 to 27.2.2. - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/jest/commits/v27.2.2/packages/pretty-format) --- updated-dependencies: - dependency-name: pretty-format dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- yarn.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index b41da22bc2c..8d5ed3cb593 100644 --- a/yarn.lock +++ b/yarn.lock @@ -759,10 +759,10 @@ source-map "^0.6.1" write-file-atomic "^3.0.0" -"@jest/types@^27.1.0": - version "27.1.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.1.0.tgz#674a40325eab23c857ebc0689e7e191a3c5b10cc" - integrity sha512-pRP5cLIzN7I7Vp6mHKRSaZD7YpBTK7hawx5si8trMKqk4+WOdK8NEKOTO2G8PKWD1HbKMVckVB6/XHh/olhf2g== +"@jest/types@^27.1.0", "@jest/types@^27.1.1": + version "27.1.1" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.1.1.tgz#77a3fc014f906c65752d12123a0134359707c0ad" + integrity sha512-yqJPDDseb0mXgKqmNqypCsb85C22K1aY5+LUxh7syIM9n/b0AsaltxNy+o6tt29VcfGDpYEve175bm3uOhcehA== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" @@ -1299,10 +1299,10 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@^5.0.0, ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" @@ -4845,12 +4845,12 @@ prettier@^2.0.5, prettier@^2.2.0: integrity sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ== pretty-format@^27.0.0, pretty-format@^27.0.2, pretty-format@^27.1.0: - version "27.1.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.1.0.tgz#022f3fdb19121e0a2612f3cff8d724431461b9ca" - integrity sha512-4aGaud3w3rxAO6OXmK3fwBFQ0bctIOG3/if+jYEFGNGIs0EvuidQm3bZ9mlP2/t9epLNC/12czabfy7TZNSwVA== + version "27.2.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.2.2.tgz#c080f1ab7ac64302e4d438f208596fc649dbeeb3" + integrity sha512-+DdLh+rtaElc2SQOE/YPH8k2g3Rf2OXWEpy06p8Szs3hdVSYD87QOOlYRHWAeb/59XTmeVmRKvDD0svHqf6ycA== dependencies: - "@jest/types" "^27.1.0" - ansi-regex "^5.0.0" + "@jest/types" "^27.1.1" + ansi-regex "^5.0.1" ansi-styles "^5.0.0" react-is "^17.0.1" From fabe0d0977a35720661adce89060eda3798f02e0 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 27 Sep 2021 16:20:15 +0200 Subject: [PATCH 24/34] fix broken FlagDependencyExportsPlugin mem caching --- lib/FlagDependencyExportsPlugin.js | 36 ++++++++---------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js index b98b222e260..871eba456b0 100644 --- a/lib/FlagDependencyExportsPlugin.js +++ b/lib/FlagDependencyExportsPlugin.js @@ -28,7 +28,6 @@ class FlagDependencyExportsPlugin { compilation => { const moduleGraph = compilation.moduleGraph; const cache = compilation.getCache("FlagDependencyExportsPlugin"); - const { moduleMemCaches } = compilation; compilation.hooks.finishModules.tapAsync( "FlagDependencyExportsPlugin", (modules, callback) => { @@ -42,6 +41,8 @@ class FlagDependencyExportsPlugin { let statNotCached = 0; let statQueueItemsProcessed = 0; + const { moduleMemCaches } = compilation; + /** @type {Queue} */ const queue = new Queue(); @@ -68,12 +69,10 @@ class FlagDependencyExportsPlugin { return callback(); } const memCache = moduleMemCaches && moduleMemCaches.get(module); - const memCacheValue = memCache && memCache.get(this, module); + const memCacheValue = memCache && memCache.get(module, this); if (memCacheValue !== undefined) { statRestoredFromMemCache++; - moduleGraph - .getExportsInfo(module) - .restoreProvided(memCacheValue); + exportsInfo.restoreProvided(memCacheValue); return callback(); } cache.get( @@ -84,9 +83,7 @@ class FlagDependencyExportsPlugin { if (result !== undefined) { statRestoredFromCache++; - moduleGraph - .getExportsInfo(module) - .restoreProvided(result); + exportsInfo.restoreProvided(result); } else { statNotCached++; // Without cached info enqueue module for determining the exports @@ -102,9 +99,7 @@ class FlagDependencyExportsPlugin { if (err) return callback(err); /** @type {Set} */ - const modulesToStorePersistent = new Set(); - /** @type {Set} */ - const modulesToStoreTransient = new Set(); + const modulesToStore = new Set(); /** @type {Map>} */ const dependencies = new Map(); @@ -338,9 +333,7 @@ class FlagDependencyExportsPlugin { } if (cacheable) { - modulesToStorePersistent.add(module); - } else { - modulesToStoreTransient.add(module); + modulesToStore.add(module); } if (changed) { @@ -366,7 +359,7 @@ class FlagDependencyExportsPlugin { logger.time("store provided exports into cache"); asyncLib.each( - modulesToStorePersistent, + modulesToStore, (module, callback) => { if (typeof module.buildInfo.hash !== "string") { // not cacheable @@ -378,7 +371,7 @@ class FlagDependencyExportsPlugin { const memCache = moduleMemCaches && moduleMemCaches.get(module); if (memCache) { - memCache.set(this, module, cachedData); + memCache.set(module, this, cachedData); } cache.store( module.identifier(), @@ -389,17 +382,6 @@ class FlagDependencyExportsPlugin { }, err => { logger.timeEnd("store provided exports into cache"); - if (moduleMemCaches) { - for (const module of modulesToStoreTransient) { - const memCache = moduleMemCaches.get(module); - if (memCache) { - const cachedData = moduleGraph - .getExportsInfo(module) - .getRestoreProvidedData(); - memCache.set(this, module, cachedData); - } - } - } callback(err); } ); From b08d6c959a564361294bedf5727382f694133ad4 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 27 Sep 2021 16:31:42 +0200 Subject: [PATCH 25/34] make WeakTupleMap use less memory --- lib/util/WeakTupleMap.js | 187 ++++++++++++++++++++------------------- 1 file changed, 95 insertions(+), 92 deletions(-) diff --git a/lib/util/WeakTupleMap.js b/lib/util/WeakTupleMap.js index be2bb332455..6df29803377 100644 --- a/lib/util/WeakTupleMap.js +++ b/lib/util/WeakTupleMap.js @@ -7,87 +7,20 @@ const isWeakKey = thing => typeof thing === "object" && thing !== null; -class WeakTupleNode { - constructor() { - this.f = 0; - /** @type {any} */ - this.v = undefined; - /** @type {Map | undefined} */ - this.m = undefined; - /** @type {WeakMap | undefined} */ - this.w = undefined; - } - - getValue() { - return this.v; - } - - hasValue() { - return (this.f & 1) === 1; - } - - setValue(v) { - this.f |= 1; - this.v = v; - } - - deleteValue() { - this.f &= 6; - this.v = undefined; - } - - peek(thing) { - if (isWeakKey(thing)) { - if ((this.f & 4) !== 4) return undefined; - return this.w.get(thing); - } else { - if ((this.f & 2) !== 2) return undefined; - return this.m.get(thing); - } - } - - get(thing) { - if (isWeakKey(thing)) { - if ((this.f & 4) !== 4) { - const newMap = new WeakMap(); - this.f |= 4; - const newNode = new WeakTupleNode(); - (this.w = newMap).set(thing, newNode); - return newNode; - } - const entry = this.w.get(thing); - if (entry !== undefined) { - return entry; - } - const newNode = new WeakTupleNode(); - this.w.set(thing, newNode); - return newNode; - } else { - if ((this.f & 2) !== 2) { - const newMap = new Map(); - this.f |= 2; - const newNode = new WeakTupleNode(); - (this.m = newMap).set(thing, newNode); - return newNode; - } - const entry = this.m.get(thing); - if (entry !== undefined) { - return entry; - } - const newNode = new WeakTupleNode(); - this.m.set(thing, newNode); - return newNode; - } - } -} - /** * @template {any[]} T * @template V */ class WeakTupleMap { constructor() { - this._node = new WeakTupleNode(); + /** @private */ + this.f = 0; + /** @private @type {any} */ + this.v = undefined; + /** @private @type {Map> | undefined} */ + this.m = undefined; + /** @private @type {WeakMap> | undefined} */ + this.w = undefined; } /** @@ -95,11 +28,12 @@ class WeakTupleMap { * @returns {void} */ set(...args) { - let node = this._node; + /** @type {WeakTupleMap} */ + let node = this; for (let i = 0; i < args.length - 1; i++) { - node = node.get(args[i]); + node = node._get(args[i]); } - node.setValue(args[args.length - 1]); + node._setValue(args[args.length - 1]); } /** @@ -107,12 +41,13 @@ class WeakTupleMap { * @returns {boolean} true, if the tuple is in the Set */ has(...args) { - let node = this._node; + /** @type {WeakTupleMap} */ + let node = this; for (let i = 0; i < args.length; i++) { - node = node.peek(args[i]); + node = node._peek(args[i]); if (node === undefined) return false; } - return node.hasValue(); + return node._hasValue(); } /** @@ -120,12 +55,13 @@ class WeakTupleMap { * @returns {V} the value */ get(...args) { - let node = this._node; + /** @type {WeakTupleMap} */ + let node = this; for (let i = 0; i < args.length; i++) { - node = node.peek(args[i]); + node = node._peek(args[i]); if (node === undefined) return undefined; } - return node.getValue(); + return node._getValue(); } /** @@ -133,14 +69,15 @@ class WeakTupleMap { * @returns {V} the value */ provide(...args) { - let node = this._node; + /** @type {WeakTupleMap} */ + let node = this; for (let i = 0; i < args.length - 1; i++) { - node = node.get(args[i]); + node = node._get(args[i]); } - if (node.hasValue()) return node.getValue(); + if (node._hasValue()) return node._getValue(); const fn = args[args.length - 1]; const newValue = fn(...args.slice(0, -1)); - node.setValue(newValue); + node._setValue(newValue); return newValue; } @@ -149,19 +86,85 @@ class WeakTupleMap { * @returns {void} */ delete(...args) { - let node = this._node; + /** @type {WeakTupleMap} */ + let node = this; for (let i = 0; i < args.length; i++) { - node = node.peek(args[i]); + node = node._peek(args[i]); if (node === undefined) return; } - node.deleteValue(); + node._deleteValue(); } /** * @returns {void} */ clear() { - this._node = new WeakTupleNode(); + this.f = 0; + this.v = undefined; + this.w = undefined; + this.m = undefined; + } + + _getValue() { + return this.v; + } + + _hasValue() { + return (this.f & 1) === 1; + } + + _setValue(v) { + this.f |= 1; + this.v = v; + } + + _deleteValue() { + this.f &= 6; + this.v = undefined; + } + + _peek(thing) { + if (isWeakKey(thing)) { + if ((this.f & 4) !== 4) return undefined; + return this.w.get(thing); + } else { + if ((this.f & 2) !== 2) return undefined; + return this.m.get(thing); + } + } + + _get(thing) { + if (isWeakKey(thing)) { + if ((this.f & 4) !== 4) { + const newMap = new WeakMap(); + this.f |= 4; + const newNode = new WeakTupleMap(); + (this.w = newMap).set(thing, newNode); + return newNode; + } + const entry = this.w.get(thing); + if (entry !== undefined) { + return entry; + } + const newNode = new WeakTupleMap(); + this.w.set(thing, newNode); + return newNode; + } else { + if ((this.f & 2) !== 2) { + const newMap = new Map(); + this.f |= 2; + const newNode = new WeakTupleMap(); + (this.m = newMap).set(thing, newNode); + return newNode; + } + const entry = this.m.get(thing); + if (entry !== undefined) { + return entry; + } + const newNode = new WeakTupleMap(); + this.m.set(thing, newNode); + return newNode; + } } } From 2393892434b88c6ee7452d2661cf8120a2046375 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 27 Sep 2021 16:41:26 +0200 Subject: [PATCH 26/34] assign each module it's own mem cache instead of receiving a per module node per access --- lib/Compilation.js | 26 +++++++++-------- lib/Compiler.js | 4 +-- lib/FlagDependencyExportsPlugin.js | 4 +-- lib/MemCache.js | 45 ------------------------------ types.d.ts | 21 ++++++++------ 5 files changed, 32 insertions(+), 68 deletions(-) delete mode 100644 lib/MemCache.js diff --git a/lib/Compilation.js b/lib/Compilation.js index d8846b966c0..664eb876b11 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -38,7 +38,6 @@ const { tryRunOrWebpackError } = require("./HookWebpackError"); const MainTemplate = require("./MainTemplate"); -const MemCache = require("./MemCache"); const Module = require("./Module"); const ModuleDependencyError = require("./ModuleDependencyError"); const ModuleDependencyWarning = require("./ModuleDependencyWarning"); @@ -61,6 +60,7 @@ const { equals: arrayEquals } = require("./util/ArrayHelpers"); const AsyncQueue = require("./util/AsyncQueue"); const LazySet = require("./util/LazySet"); const { provide } = require("./util/MapHelpers"); +const WeakTupleMap = require("./util/WeakTupleMap"); const { cachedCleverMerge } = require("./util/cleverMerge"); const { compareLocations, @@ -893,9 +893,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }; defineRemovedModuleTemplates(this.moduleTemplates); - /** @type {MemCache | undefined} */ - this.memCache = undefined; - /** @type {WeakMap | undefined} */ + /** @type {WeakMap | undefined} */ this.moduleMemCaches = undefined; this.moduleGraph = new ModuleGraph(); /** @type {ChunkGraph} */ @@ -2021,8 +2019,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si const moduleMemCacheCache = this.compiler.moduleMemCaches; if (!moduleMemCacheCache) return; if (!this.moduleMemCaches) this.moduleMemCaches = new WeakMap(); - if (!this.memCache) this.memCache = new MemCache(); - const { moduleGraph, memCache, moduleMemCaches } = this; + const { moduleGraph, moduleMemCaches } = this; const affectedModules = new Set(); const infectedModules = new Set(); let statNew = 0; @@ -2035,6 +2032,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si const cachedMemCache = moduleMemCacheCache.get(module); if (cachedMemCache === undefined) { // create a new entry + const memCache = new WeakTupleMap(); moduleMemCacheCache.set(module, { hash: hash, memCache @@ -2048,6 +2046,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si statUnchanged++; } else { // use a new one + const memCache = new WeakTupleMap(); + moduleMemCacheCache.set(module, { + hash: hash, + memCache + }); moduleMemCaches.set(module, memCache); affectedModules.add(module); cachedMemCache.hash = hash; @@ -2075,6 +2078,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si if (infectedModules.has(referencingModule)) continue; if (affectedModules.has(referencingModule)) continue; affectedModules.add(referencingModule); + const memCache = new WeakTupleMap(); + const cache = moduleMemCacheCache.get(module); + cache.memCache = memCache; moduleMemCaches.set(referencingModule, memCache); } } @@ -2289,7 +2295,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si // TODO only run for modules with changed cacheToken // global WeakMap> to keep modules without errors/warnings const memCache = moduleMemCaches && moduleMemCaches.get(module); - if (memCache && memCache.get(module, "noWarningsOrErrors")) continue; + if (memCache && memCache.get("noWarningsOrErrors")) continue; let hasProblems = this.reportDependencyErrorsAndWarnings(module, [ module ]); @@ -2313,8 +2319,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si hasProblems = true; } } - if (!hasProblems && memCache) - memCache.set(module, "noWarningsOrErrors", true); + if (!hasProblems && memCache) memCache.set("noWarningsOrErrors", true); } this.moduleGraph.unfreeze(); this.logger.timeEnd("report dependency errors and warnings"); @@ -2911,7 +2916,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o const moduleRuntimeRequirementsMemCache = memCache && memCache.provide( - module, "moduleRuntimeRequirements", () => new RuntimeSpecMap() ); @@ -3371,7 +3375,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o /** @type {RuntimeSpecMap} */ const moduleHashesMemCache = memCache && - memCache.provide(module, "moduleHashes", () => new RuntimeSpecMap()); + memCache.provide("moduleHashes", () => new RuntimeSpecMap()); for (const runtime of chunkGraph.getModuleRuntimes(module)) { if (moduleHashesMemCache) { const digest = moduleHashesMemCache.get(runtime); diff --git a/lib/Compiler.js b/lib/Compiler.js index f5d1d3039ee..4a54f76e0c2 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -41,8 +41,8 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ /** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */ -/** @typedef {import("./MemCache")} MemCache */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./util/WeakTupleMap")} WeakTupleMap */ /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ /** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */ /** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */ @@ -248,7 +248,7 @@ class Compiler { this.cache = new Cache(); - /** @type {WeakMap | undefined} */ + /** @type {WeakMap | undefined} */ this.moduleMemCaches = undefined; this.compilerPath = ""; diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js index 871eba456b0..22e93520973 100644 --- a/lib/FlagDependencyExportsPlugin.js +++ b/lib/FlagDependencyExportsPlugin.js @@ -69,7 +69,7 @@ class FlagDependencyExportsPlugin { return callback(); } const memCache = moduleMemCaches && moduleMemCaches.get(module); - const memCacheValue = memCache && memCache.get(module, this); + const memCacheValue = memCache && memCache.get(this); if (memCacheValue !== undefined) { statRestoredFromMemCache++; exportsInfo.restoreProvided(memCacheValue); @@ -371,7 +371,7 @@ class FlagDependencyExportsPlugin { const memCache = moduleMemCaches && moduleMemCaches.get(module); if (memCache) { - memCache.set(module, this, cachedData); + memCache.set(this, cachedData); } cache.store( module.identifier(), diff --git a/lib/MemCache.js b/lib/MemCache.js deleted file mode 100644 index a6cbe5c527f..00000000000 --- a/lib/MemCache.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - -"use strict"; - -const WeakTupleMap = require("./util/WeakTupleMap"); - -class MemCache { - constructor() { - this._cache = new WeakTupleMap(); - } - - /** - * @template {any[]} T - * @template V - * @param {T} args arguments - * @returns {V | undefined} cached value - */ - get(...args) { - return this._cache.get(...args); - } - - /** - * @template {[...any[], any]} T - * @param {T} args arguments - * @returns {void} - */ - set(...args) { - this._cache.set(...args); - } - - /** - * @template {[...any[], (...args: any[]) => V]} T - * @template V - * @param {T} args arguments - * @returns {V} computed value or cached - */ - provide(...args) { - return this._cache.provide(...args); - } -} - -module.exports = MemCache; diff --git a/types.d.ts b/types.d.ts index 50a81734698..97c578c4c8e 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1459,8 +1459,7 @@ declare class Compilation { chunkTemplate: ChunkTemplate; runtimeTemplate: RuntimeTemplate; moduleTemplates: { javascript: ModuleTemplate }; - memCache?: MemCache; - moduleMemCaches?: WeakMap; + moduleMemCaches?: WeakMap>; moduleGraph: ModuleGraph; chunkGraph: ChunkGraph; codeGenerationResults: CodeGenerationResults; @@ -1897,7 +1896,10 @@ declare class Compiler { context: string; requestShortener: RequestShortener; cache: Cache; - moduleMemCaches?: WeakMap; + moduleMemCaches?: WeakMap< + Module, + { hash: string; memCache: WeakTupleMap } + >; compilerPath: string; running: boolean; idle: boolean; @@ -6313,11 +6315,6 @@ declare interface MapOptions { columns?: boolean; module?: boolean; } -declare abstract class MemCache { - get(...args: T): undefined | V; - set(...args: T): void; - provide V)[]], V>(...args: T): V; -} /** * Options object for in-memory caching. @@ -11647,6 +11644,14 @@ declare abstract class Watching { resume(): void; close(callback: CallbackFunction): void; } +declare abstract class WeakTupleMap { + set(...args: [T, ...V[]]): void; + has(...args: T): boolean; + get(...args: T): V; + provide(...args: [T, ...(() => V)[]]): V; + delete(...args: T): void; + clear(): void; +} declare interface WebAssemblyRenderContext { /** * the chunk From 16fc4bb7af6f1e39736d161cbb314e3bd7b3f84d Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 27 Sep 2021 16:43:34 +0200 Subject: [PATCH 27/34] allow dependencies to select level of propagation --- lib/Compilation.js | 48 +++++++++++++++---- lib/Dependency.js | 11 +++++ .../CommonJsExportRequireDependency.js | 8 ++++ lib/dependencies/ContextDependency.js | 8 ++++ ...armonyExportImportedSpecifierDependency.js | 8 ++++ lib/dependencies/ModuleDependency.js | 8 ++++ lib/dependencies/NullDependency.js | 12 +++-- .../WebAssemblyExportImportedDependency.js | 9 ++++ types.d.ts | 6 +++ 9 files changed, 105 insertions(+), 13 deletions(-) diff --git a/lib/Compilation.js b/lib/Compilation.js index 664eb876b11..102779c81cf 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -25,6 +25,7 @@ const ChunkRenderError = require("./ChunkRenderError"); const ChunkTemplate = require("./ChunkTemplate"); const CodeGenerationError = require("./CodeGenerationError"); const CodeGenerationResults = require("./CodeGenerationResults"); +const Dependency = require("./Dependency"); const DependencyTemplates = require("./DependencyTemplates"); const Entrypoint = require("./Entrypoint"); const ErrorHelpers = require("./ErrorHelpers"); @@ -93,7 +94,6 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ /** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./DependenciesBlock")} DependenciesBlock */ -/** @typedef {import("./Dependency")} Dependency */ /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("./DependencyTemplate")} DependencyTemplate */ @@ -2062,28 +2062,58 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si statWithoutHash++; } } + const reduceAffectType = connections => { + let affected = false; + for (const { dependency } of connections) { + if (!dependency) continue; + const type = dependency.couldAffectReferencingModule(); + if (type === Dependency.TRANSITIVE) return Dependency.TRANSITIVE; + if (type === false) continue; + affected = true; + } + return affected; + }; + const directOnlyInfectedModules = new Set(); for (const module of infectedModules) { - for (const referencingModule of moduleGraph - .getIncomingConnectionsByOriginModule(module) - .keys()) { + for (const [ + referencingModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { + if (!referencingModule) continue; if (infectedModules.has(referencingModule)) continue; - infectedModules.add(referencingModule); + const type = reduceAffectType(connections); + if (!type) continue; + if (type === true) { + directOnlyInfectedModules.add(referencingModule); + } else { + infectedModules.add(referencingModule); + } } } + for (const module of directOnlyInfectedModules) infectedModules.add(module); + const directOnlyAffectModules = new Set(); for (const module of affectedModules) { - for (const referencingModule of moduleGraph - .getIncomingConnectionsByOriginModule(module) - .keys()) { + for (const [ + referencingModule, + connections + ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) { if (!referencingModule) continue; if (infectedModules.has(referencingModule)) continue; if (affectedModules.has(referencingModule)) continue; - affectedModules.add(referencingModule); + const type = reduceAffectType(connections); + if (!type) continue; + if (type === true) { + directOnlyAffectModules.add(referencingModule); + } else { + affectedModules.add(referencingModule); + } const memCache = new WeakTupleMap(); const cache = moduleMemCacheCache.get(module); cache.memCache = memCache; moduleMemCaches.set(referencingModule, memCache); } } + for (const module of directOnlyAffectModules) affectedModules.add(module); this.logger.log( `${Math.round( (100 * (affectedModules.size + infectedModules.size)) / diff --git a/lib/Dependency.js b/lib/Dependency.js index 9f87a0adb6e..18827090fe4 100644 --- a/lib/Dependency.js +++ b/lib/Dependency.js @@ -78,6 +78,8 @@ const memoize = require("./util/memoize"); * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true */ +const TRANSITIVE = Symbol("transitive"); + const getIgnoredModule = memoize(() => { const RawModule = require("./RawModule"); return new RawModule("/* (ignored) */", `ignored`, `(ignored)`); @@ -175,6 +177,13 @@ class Dependency { return null; } + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return TRANSITIVE; + } + /** * Returns the referenced module and export * @deprecated @@ -322,4 +331,6 @@ Object.defineProperty(Dependency.prototype, "disconnect", { } }); +Dependency.TRANSITIVE = TRANSITIVE; + module.exports = Dependency; diff --git a/lib/dependencies/CommonJsExportRequireDependency.js b/lib/dependencies/CommonJsExportRequireDependency.js index 9b6b2d05813..2facb698164 100644 --- a/lib/dependencies/CommonJsExportRequireDependency.js +++ b/lib/dependencies/CommonJsExportRequireDependency.js @@ -18,6 +18,7 @@ const processExportInfo = require("./processExportInfo"); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ @@ -43,6 +44,13 @@ class CommonJsExportRequireDependency extends ModuleDependency { return "cjs export require"; } + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; + } + /** * @param {ModuleGraph} moduleGraph the module graph * @returns {string[]} the imported id diff --git a/lib/dependencies/ContextDependency.js b/lib/dependencies/ContextDependency.js index 52dae0b6b0e..febeded4d61 100644 --- a/lib/dependencies/ContextDependency.js +++ b/lib/dependencies/ContextDependency.js @@ -11,6 +11,7 @@ const makeSerializable = require("../util/makeSerializable"); const memoize = require("../util/memoize"); /** @typedef {import("../ContextModule").ContextOptions} ContextOptions */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../WebpackError")} WebpackError */ @@ -54,6 +55,13 @@ class ContextDependency extends Dependency { return "commonjs"; } + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return true; + } + /** * @returns {string | null} an identifier to merge equal requests */ diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index ca346b5e2c6..f76651a4dfc 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -23,6 +23,7 @@ const processExportInfo = require("./processExportInfo"); /** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../ExportsInfo")} ExportsInfo */ @@ -183,6 +184,13 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { this._getMode = this._getMode.bind(this); } + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; + } + // TODO webpack 6 remove get id() { throw new Error("id was renamed to ids and type changed to string[]"); diff --git a/lib/dependencies/ModuleDependency.js b/lib/dependencies/ModuleDependency.js index 45e1a9c11f7..d94e7a6d1f0 100644 --- a/lib/dependencies/ModuleDependency.js +++ b/lib/dependencies/ModuleDependency.js @@ -9,6 +9,7 @@ const Dependency = require("../Dependency"); const DependencyTemplate = require("../DependencyTemplate"); const memoize = require("../util/memoize"); +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../Module")} Module */ const getRawModule = memoize(() => require("../RawModule")); @@ -38,6 +39,13 @@ class ModuleDependency extends Dependency { return str; } + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return true; + } + /** * @param {string} context context directory * @returns {Module} a module diff --git a/lib/dependencies/NullDependency.js b/lib/dependencies/NullDependency.js index c4cb31cea46..c22cafc7c7a 100644 --- a/lib/dependencies/NullDependency.js +++ b/lib/dependencies/NullDependency.js @@ -9,16 +9,20 @@ const Dependency = require("../Dependency"); const DependencyTemplate = require("../DependencyTemplate"); /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ -/** @typedef {import("../ChunkGraph")} ChunkGraph */ -/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ -/** @typedef {import("../ModuleGraph")} ModuleGraph */ -/** @typedef {import("../util/Hash")} Hash */ class NullDependency extends Dependency { get type() { return "null"; } + + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return false; + } } NullDependency.Template = class NullDependencyTemplate extends ( diff --git a/lib/dependencies/WebAssemblyExportImportedDependency.js b/lib/dependencies/WebAssemblyExportImportedDependency.js index bfa0d08b19f..ec3f3afac0e 100644 --- a/lib/dependencies/WebAssemblyExportImportedDependency.js +++ b/lib/dependencies/WebAssemblyExportImportedDependency.js @@ -5,10 +5,12 @@ "use strict"; +const Dependency = require("../Dependency"); const makeSerializable = require("../util/makeSerializable"); const ModuleDependency = require("./ModuleDependency"); /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ +/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ @@ -23,6 +25,13 @@ class WebAssemblyExportImportedDependency extends ModuleDependency { this.valueType = valueType; } + /** + * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module + */ + couldAffectReferencingModule() { + return Dependency.TRANSITIVE; + } + /** * Returns list of exports referenced by this dependency * @param {ModuleGraph} moduleGraph module graph diff --git a/types.d.ts b/types.d.ts index 97c578c4c8e..e96bd465c91 100644 --- a/types.d.ts +++ b/types.d.ts @@ -2243,6 +2243,7 @@ declare class ConstDependency extends NullDependency { static Template: typeof ConstDependencyTemplate; static NO_EXPORTS_REFERENCED: string[][]; static EXPORTS_OBJECT_REFERENCED: string[][]; + static TRANSITIVE: typeof TRANSITIVE; } declare class ConstDependencyTemplate extends NullDependencyTemplate { constructor(); @@ -2556,6 +2557,7 @@ declare class Dependency { readonly category: string; loc: DependencyLocation; getResourceIdentifier(): null | string; + couldAffectReferencingModule(): boolean | typeof TRANSITIVE; /** * Returns the referenced module and export @@ -2610,6 +2612,7 @@ declare class Dependency { readonly disconnect: any; static NO_EXPORTS_REFERENCED: string[][]; static EXPORTS_OBJECT_REFERENCED: string[][]; + static TRANSITIVE: typeof TRANSITIVE; } declare interface DependencyConstructor { new (...args: any[]): Dependency; @@ -6521,6 +6524,7 @@ declare class ModuleDependency extends Dependency { static Template: typeof DependencyTemplate; static NO_EXPORTS_REFERENCED: string[][]; static EXPORTS_OBJECT_REFERENCED: string[][]; + static TRANSITIVE: typeof TRANSITIVE; } declare abstract class ModuleFactory { create( @@ -7508,6 +7512,7 @@ declare class NullDependency extends Dependency { static Template: typeof NullDependencyTemplate; static NO_EXPORTS_REFERENCED: string[][]; static EXPORTS_OBJECT_REFERENCED: string[][]; + static TRANSITIVE: typeof TRANSITIVE; } declare class NullDependencyTemplate extends DependencyTemplate { constructor(); @@ -11280,6 +11285,7 @@ declare interface SyntheticDependencyLocation { index?: number; } declare const TOMBSTONE: unique symbol; +declare const TRANSITIVE: unique symbol; declare const TRANSITIVE_ONLY: unique symbol; declare interface TagInfo { tag: any; From c33a64bb238e28243741cb5b18691faf2f09e237 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 27 Sep 2021 17:21:09 +0200 Subject: [PATCH 28/34] enable to use mem cache for dependency caching --- lib/Compilation.js | 11 +- lib/ModuleGraph.js | 41 ++- ...armonyExportImportedSpecifierDependency.js | 334 +++++++++--------- types.d.ts | 6 +- 4 files changed, 223 insertions(+), 169 deletions(-) diff --git a/lib/Compilation.js b/lib/Compilation.js index 102779c81cf..96e1059d543 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -893,7 +893,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }; defineRemovedModuleTemplates(this.moduleTemplates); - /** @type {WeakMap | undefined} */ + /** @type {WeakMap> | undefined} */ this.moduleMemCaches = undefined; this.moduleGraph = new ModuleGraph(); /** @type {ChunkGraph} */ @@ -2018,7 +2018,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si _computeAffectedModules(modules) { const moduleMemCacheCache = this.compiler.moduleMemCaches; if (!moduleMemCacheCache) return; - if (!this.moduleMemCaches) this.moduleMemCaches = new WeakMap(); + if (!this.moduleMemCaches) { + this.moduleMemCaches = new WeakMap(); + this.moduleGraph.setModuleMemCaches(this.moduleMemCaches); + } const { moduleGraph, moduleMemCaches } = this; const affectedModules = new Set(); const infectedModules = new Set(); @@ -2316,7 +2319,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si if (err) return callback(err); // extract warnings and errors from modules - this.moduleGraph.freeze(); + this.moduleGraph.freeze("dependency errors"); // TODO keep a cacheToken (= {}) for each module in the graph // create a new one per compilation and flag all updated files // and parents with it @@ -2406,7 +2409,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.logger.time("create chunks"); this.hooks.beforeChunks.call(); - this.moduleGraph.freeze(); + this.moduleGraph.freeze("seal"); /** @type {Map} */ const chunkGraphInit = new Map(); for (const [name, { dependencies, includeDependencies, options }] of this diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index 8e9fc3ba656..f50ebbdc296 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -103,6 +103,9 @@ class ModuleGraph { /** @type {WeakTupleMap} */ this._cache = undefined; + + /** @type {WeakMap>} */ + this._moduleMemCaches = undefined; } /** @@ -669,12 +672,17 @@ class ModuleGraph { return this._metaMap.get(thing); } - freeze() { + /** + * @param {string=} cacheStage a persistent stage name for caching + */ + freeze(cacheStage) { this._cache = new WeakTupleMap(); + this._cacheStage = cacheStage; } unfreeze() { this._cache = undefined; + this._cacheStage = undefined; } /** @@ -689,6 +697,37 @@ class ModuleGraph { return this._cache.provide(fn, ...args, () => fn(this, ...args)); } + /** + * @param {WeakMap>} moduleMemCaches mem caches for modules for better caching + */ + setModuleMemCaches(moduleMemCaches) { + this._moduleMemCaches = moduleMemCaches; + } + + /** + * @param {Dependency} dependency dependency + * @param {...any} args arguments, last argument is a function called with moduleGraph, dependency, ...args + * @returns {any} computed value or cached + */ + dependencyCacheProvide(dependency, ...args) { + /** @type {(moduleGraph: ModuleGraph, dependency: Dependency, ...args: any[]) => any} */ + const fn = args.pop(); + if (this._moduleMemCaches && this._cacheStage) { + const memCache = this._moduleMemCaches.get( + this.getParentModule(dependency) + ); + if (memCache !== undefined) { + return memCache.provide(dependency, this._cacheStage, ...args, () => + fn(this, dependency, ...args) + ); + } + } + if (this._cache === undefined) return fn(this, dependency, ...args); + return this._cache.provide(dependency, ...args, () => + fn(this, dependency, ...args) + ); + } + // TODO remove in webpack 6 /** * @param {Module} module the module diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index f76651a4dfc..bdc28624c05 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -15,6 +15,7 @@ const { countIterable } = require("../util/IterableHelpers"); const { first, combine } = require("../util/SetHelpers"); const makeSerializable = require("../util/makeSerializable"); const propertyAccess = require("../util/propertyAccess"); +const { getRuntimeKey, keyToRuntime } = require("../util/runtime"); const HarmonyExportInitFragment = require("./HarmonyExportInitFragment"); const HarmonyImportDependency = require("./HarmonyImportDependency"); const processExportInfo = require("./processExportInfo"); @@ -150,6 +151,172 @@ const findDependencyForName = ( return undefined; }; +/** + * @param {ModuleGraph} moduleGraph the module graph + * @param {HarmonyExportImportedSpecifierDependency} dep the dependency + * @param {string} runtimeKey the runtime key + * @returns {ExportMode} the export mode + */ +const getMode = (moduleGraph, dep, runtimeKey) => { + const importedModule = moduleGraph.getModule(dep); + + if (!importedModule) { + const mode = new ExportMode("missing"); + + mode.userRequest = dep.userRequest; + + return mode; + } + + const name = dep.name; + const runtime = keyToRuntime(runtimeKey); + const parentModule = moduleGraph.getParentModule(dep); + const exportsInfo = moduleGraph.getExportsInfo(parentModule); + + if ( + name + ? exportsInfo.getUsed(name, runtime) === UsageState.Unused + : exportsInfo.isUsed(runtime) === false + ) { + const mode = new ExportMode("unused"); + + mode.name = name || "*"; + + return mode; + } + + const importedExportsType = importedModule.getExportsType( + moduleGraph, + parentModule.buildMeta.strictHarmonyModule + ); + + const ids = dep.getIds(moduleGraph); + + // Special handling for reexporting the default export + // from non-namespace modules + if (name && ids.length > 0 && ids[0] === "default") { + switch (importedExportsType) { + case "dynamic": { + const mode = new ExportMode("reexport-dynamic-default"); + + mode.name = name; + + return mode; + } + case "default-only": + case "default-with-named": { + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + const mode = new ExportMode("reexport-named-default"); + + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + + return mode; + } + } + } + + // reexporting with a fixed name + if (name) { + let mode; + const exportInfo = exportsInfo.getReadOnlyExportInfo(name); + + if (ids.length > 0) { + // export { name as name } + switch (importedExportsType) { + case "default-only": + mode = new ExportMode("reexport-undefined"); + mode.name = name; + break; + default: + mode = new ExportMode("normal-reexport"); + mode.items = [ + new NormalReexportItem(name, ids, exportInfo, false, false) + ]; + break; + } + } else { + // export * as name + switch (importedExportsType) { + case "default-only": + mode = new ExportMode("reexport-fake-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + mode.fakeType = 0; + break; + case "default-with-named": + mode = new ExportMode("reexport-fake-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + mode.fakeType = 2; + break; + case "dynamic": + default: + mode = new ExportMode("reexport-namespace-object"); + mode.name = name; + mode.partialNamespaceExportInfo = exportInfo; + } + } + + return mode; + } + + // Star reexporting + + const { ignoredExports, exports, checked, hidden } = dep.getStarReexports( + moduleGraph, + runtime, + exportsInfo, + importedModule + ); + if (!exports) { + // We have too few info about the modules + // Delegate the logic to the runtime code + + const mode = new ExportMode("dynamic-reexport"); + mode.ignored = ignoredExports; + mode.hidden = hidden; + + return mode; + } + + if (exports.size === 0) { + const mode = new ExportMode("empty-star"); + mode.hidden = hidden; + + return mode; + } + + const mode = new ExportMode("normal-reexport"); + + mode.items = Array.from( + exports, + exportName => + new NormalReexportItem( + exportName, + [exportName], + exportsInfo.getReadOnlyExportInfo(exportName), + checked.has(exportName), + false + ) + ); + if (hidden !== undefined) { + for (const exportName of hidden) { + mode.items.push( + new NormalReexportItem( + exportName, + [exportName], + exportsInfo.getReadOnlyExportInfo(exportName), + false, + true + ) + ); + } + } + + return mode; +}; + class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { /** * @param {string} request the request string @@ -181,7 +348,6 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { this.otherStarExports = otherStarExports; this.strictExportPresence = strictExportPresence; this.allStarExports = allStarExports; - this._getMode = this._getMode.bind(this); } /** @@ -233,169 +399,11 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { * @returns {ExportMode} the export mode */ getMode(moduleGraph, runtime) { - return moduleGraph.cached(this._getMode, runtime); - } - - /** - * @param {ModuleGraph} moduleGraph the module graph - * @param {RuntimeSpec} runtime the runtime - * @returns {ExportMode} the export mode - */ - _getMode(moduleGraph, runtime) { - const name = this.name; - const ids = this.getIds(moduleGraph); - const parentModule = moduleGraph.getParentModule(this); - const importedModule = moduleGraph.getModule(this); - const exportsInfo = moduleGraph.getExportsInfo(parentModule); - - if (!importedModule) { - const mode = new ExportMode("missing"); - - mode.userRequest = this.userRequest; - - return mode; - } - - if ( - name - ? exportsInfo.getUsed(name, runtime) === UsageState.Unused - : exportsInfo.isUsed(runtime) === false - ) { - const mode = new ExportMode("unused"); - - mode.name = name || "*"; - - return mode; - } - - const importedExportsType = importedModule.getExportsType( - moduleGraph, - parentModule.buildMeta.strictHarmonyModule - ); - - // Special handling for reexporting the default export - // from non-namespace modules - if (name && ids.length > 0 && ids[0] === "default") { - switch (importedExportsType) { - case "dynamic": { - const mode = new ExportMode("reexport-dynamic-default"); - - mode.name = name; - - return mode; - } - case "default-only": - case "default-with-named": { - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - const mode = new ExportMode("reexport-named-default"); - - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - - return mode; - } - } - } - - // reexporting with a fixed name - if (name) { - let mode; - const exportInfo = exportsInfo.getReadOnlyExportInfo(name); - - if (ids.length > 0) { - // export { name as name } - switch (importedExportsType) { - case "default-only": - mode = new ExportMode("reexport-undefined"); - mode.name = name; - break; - default: - mode = new ExportMode("normal-reexport"); - mode.items = [ - new NormalReexportItem(name, ids, exportInfo, false, false) - ]; - break; - } - } else { - // export * as name - switch (importedExportsType) { - case "default-only": - mode = new ExportMode("reexport-fake-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - mode.fakeType = 0; - break; - case "default-with-named": - mode = new ExportMode("reexport-fake-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - mode.fakeType = 2; - break; - case "dynamic": - default: - mode = new ExportMode("reexport-namespace-object"); - mode.name = name; - mode.partialNamespaceExportInfo = exportInfo; - } - } - - return mode; - } - - // Star reexporting - - const { ignoredExports, exports, checked, hidden } = this.getStarReexports( - moduleGraph, - runtime, - exportsInfo, - importedModule + return moduleGraph.dependencyCacheProvide( + this, + getRuntimeKey(runtime), + getMode ); - if (!exports) { - // We have too few info about the modules - // Delegate the logic to the runtime code - - const mode = new ExportMode("dynamic-reexport"); - mode.ignored = ignoredExports; - mode.hidden = hidden; - - return mode; - } - - if (exports.size === 0) { - const mode = new ExportMode("empty-star"); - mode.hidden = hidden; - - return mode; - } - - const mode = new ExportMode("normal-reexport"); - - mode.items = Array.from( - exports, - exportName => - new NormalReexportItem( - exportName, - [exportName], - exportsInfo.getReadOnlyExportInfo(exportName), - checked.has(exportName), - false - ) - ); - if (hidden !== undefined) { - for (const exportName of hidden) { - mode.items.push( - new NormalReexportItem( - exportName, - [exportName], - exportsInfo.getReadOnlyExportInfo(exportName), - false, - true - ) - ); - } - } - - return mode; } /** diff --git a/types.d.ts b/types.d.ts index e96bd465c91..dd1431f3d9e 100644 --- a/types.d.ts +++ b/types.d.ts @@ -6708,12 +6708,16 @@ declare class ModuleGraph { setAsync(module: Module): void; getMeta(thing?: any): Object; getMetaIfExisting(thing?: any): Object; - freeze(): void; + freeze(cacheStage?: string): void; unfreeze(): void; cached( fn: (moduleGraph: ModuleGraph, ...args: T) => V, ...args: T ): V; + setModuleMemCaches( + moduleMemCaches: WeakMap> + ): void; + dependencyCacheProvide(dependency: Dependency, ...args: any[]): any; static getModuleGraphForModule( module: Module, deprecateMessage: string, From 224ed2ac0ce8f1a8dae571fd5efe63b5e3bdca3c Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 27 Sep 2021 17:21:56 +0200 Subject: [PATCH 29/34] change ModuleGraph storage to WeakMap --- lib/ModuleGraph.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index f50ebbdc296..ce371bfa935 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -84,14 +84,12 @@ class ModuleGraphModule { class ModuleGraph { constructor() { - /** @type {Map} */ - this._dependencyMap = new Map(); + /** @type {WeakMap} */ + this._dependencyMap = new WeakMap(); /** @type {Map} */ this._moduleMap = new Map(); - /** @type {Map>} */ - this._originMap = new Map(); - /** @type {Map} */ - this._metaMap = new Map(); + /** @type {WeakMap} */ + this._metaMap = new WeakMap(); // Caching this._cacheModuleGraphModuleKey1 = undefined; From 931d14615fac325ae192b91da4600297af60c458 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 27 Sep 2021 19:03:55 +0200 Subject: [PATCH 30/34] move unsafe cache from NormalModuleFactory to Compilation to skip more processing --- lib/Compilation.js | 429 ++++++++++++++++++++++++++----------- lib/Compiler.js | 6 +- lib/ModuleFactory.js | 1 + lib/NormalModuleFactory.js | 51 +---- types.d.ts | 37 +++- 5 files changed, 343 insertions(+), 181 deletions(-) diff --git a/lib/Compilation.js b/lib/Compilation.js index 96e1059d543..5431aab3e40 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -93,6 +93,7 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("./CacheFacade")} CacheFacade */ /** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ /** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./Compiler").CompilationParams} CompilationParams */ /** @typedef {import("./DependenciesBlock")} DependenciesBlock */ /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */ @@ -101,6 +102,7 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./ModuleFactory")} ModuleFactory */ /** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */ +/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ /** @typedef {import("./RequestShortener")} RequestShortener */ /** @typedef {import("./RuntimeModule")} RuntimeModule */ /** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */ @@ -125,6 +127,20 @@ const { isSourceEqual } = require("./util/source"); * @returns {void} */ +/** + * @callback ModuleFactoryResultCallback + * @param {WebpackError=} err + * @param {ModuleFactoryResult=} result + * @returns {void} + */ + +/** + * @callback ModuleOrFactoryResultCallback + * @param {WebpackError=} err + * @param {Module | ModuleFactoryResult=} result + * @returns {void} + */ + /** * @callback ExecuteModuleCallback * @param {WebpackError=} err @@ -400,12 +416,19 @@ const byLocation = compareSelect(err => err.loc, compareLocations); const compareErrors = concatComparators(byModule, byLocation, byMessage); +/** @type {WeakMap} */ +const unsafeCacheDependencies = new WeakMap(); + +/** @type {WeakMap} */ +const unsafeCacheData = new WeakMap(); + class Compilation { /** * Creates an instance of Compilation. * @param {Compiler} compiler the compiler which created the compilation + * @param {CompilationParams} params the compilation parameters */ - constructor(compiler) { + constructor(compiler, params) { const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this); /** @typedef {{ additionalAssets?: true | Function }} ProcessAssetsAdditionalOptions */ /** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */ @@ -880,6 +903,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si /** @type {boolean} */ this.profile = (options && options.profile) || false; + this.params = params; this.mainTemplate = new MainTemplate(this.outputOptions, this); this.chunkTemplate = new ChunkTemplate(this.outputOptions, this); this.runtimeTemplate = new RuntimeTemplate( @@ -914,7 +938,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si getKey: module => module.identifier(), processor: this._addModule.bind(this) }); - /** @type {AsyncQueue} */ + /** @type {AsyncQueue} */ this.factorizeQueue = new AsyncQueue({ name: "factorize", parent: this.addModuleQueue, @@ -997,6 +1021,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.usedModuleIds = null; /** @type {boolean} */ this.needAdditionalPass = false; + /** @type {Set} */ + this._restoredUnsafeCacheEntries = new Set(); /** @type {WeakSet} */ this.builtModules = new WeakSet(); /** @type {WeakSet} */ @@ -1029,6 +1055,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this._modulesCache = this.getCache("Compilation/modules"); this._assetsCache = this.getCache("Compilation/assets"); this._codeGenerationCache = this.getCache("Compilation/codeGeneration"); + + const unsafeCache = options.module.unsafeCache; + this._unsafeCache = !!unsafeCache; + this._unsafeCachePredicate = + typeof unsafeCache === "function" ? unsafeCache : () => true; } getStats() { @@ -1413,12 +1444,44 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si /** @type {Dependency[]} */ let listCacheValue; + const unsafeRestoredModules = new Set(); + /** * @param {Dependency} dep dependency * @returns {void} */ const processDependency = dep => { this.moduleGraph.setParents(dep, currentBlock, module); + if (this._unsafeCache) { + try { + const cachedModule = unsafeCacheDependencies.get(dep); + if (cachedModule === null) return; + if (cachedModule !== undefined) { + if (!this._restoredUnsafeCacheEntries.has(cachedModule)) { + const data = unsafeCacheData.get(cachedModule); + cachedModule.restoreFromUnsafeCache( + data, + this.params.normalModuleFactory, + this.params + ); + this._restoredUnsafeCacheEntries.add(cachedModule); + if (!this.modules.has(cachedModule)) { + this._handleNewModuleFromUnsafeCache(module, dep, cachedModule); + unsafeRestoredModules.add(cachedModule); + return; + } + } + this._handleExistingModuleFromUnsafeCache( + module, + dep, + cachedModule + ); + return; + } + } catch (e) { + console.error(e); + } + } const resourceIdent = dep.getResourceIdentifier(); if (resourceIdent !== undefined && resourceIdent !== null) { const category = dep.category; @@ -1502,7 +1565,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si return callback(e); } - if (sortedDependencies.length === 0) { + if (sortedDependencies.length === 0 && unsafeRestoredModules.size === 0) { callback(); return; } @@ -1510,27 +1573,78 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si // This is nested so we need to allow one additional task this.processDependenciesQueue.increaseParallelism(); - asyncLib.forEach( - sortedDependencies, - (item, callback) => { - this.handleModuleCreation(item, err => { - // In V8, the Error objects keep a reference to the functions on the stack. These warnings & - // errors are created inside closures that keep a reference to the Compilation, so errors are - // leaking the Compilation object. - if (err && this.bail) { - // eslint-disable-next-line no-self-assign - err.stack = err.stack; - return callback(err); - } - callback(); - }); - }, - err => { - this.processDependenciesQueue.decreaseParallelism(); + const processSortedDependency = (item, callback) => { + this.handleModuleCreation(item, err => { + // In V8, the Error objects keep a reference to the functions on the stack. These warnings & + // errors are created inside closures that keep a reference to the Compilation, so errors are + // leaking the Compilation object. + if (err && this.bail) { + // eslint-disable-next-line no-self-assign + err.stack = err.stack; + return callback(err); + } + callback(); + }); + }; - return callback(err); - } + const processUnsafeRestoredModule = (item, callback) => { + this._handleModuleBuildAndDependencies(module, item, true, callback); + }; + + const finalCallback = err => { + this.processDependenciesQueue.decreaseParallelism(); + + return callback(err); + }; + + if (sortedDependencies.length === 0) { + asyncLib.forEach( + unsafeRestoredModules, + processUnsafeRestoredModule, + finalCallback + ); + } else if (unsafeRestoredModules.size === 0) { + asyncLib.forEach( + sortedDependencies, + processSortedDependency, + finalCallback + ); + } else { + asyncLib.parallel( + [ + cb => + asyncLib.forEach( + unsafeRestoredModules, + processUnsafeRestoredModule, + cb + ), + cb => + asyncLib.forEach(sortedDependencies, processSortedDependency, cb) + ], + finalCallback + ); + } + } + + _handleNewModuleFromUnsafeCache(originModule, dependency, module) { + const moduleGraph = this.moduleGraph; + + moduleGraph.setResolvedModule(originModule, dependency, module); + + moduleGraph.setIssuerIfUnset( + module, + originModule !== undefined ? originModule : null ); + + this._modules.set(module.identifier(), module); + this.modules.add(module); + ModuleGraph.setModuleGraphForModule(module, this.moduleGraph); + } + + _handleExistingModuleFromUnsafeCache(originModule, dependency, module) { + const moduleGraph = this.moduleGraph; + + moduleGraph.setResolvedModule(originModule, dependency, module); } /** @@ -1570,12 +1684,27 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si currentProfile, factory, dependencies, + factoryResult: true, originModule, contextInfo, context }, - (err, newModule) => { + (err, factoryResult) => { + const applyFactoryResultDependencies = () => { + const { fileDependencies, contextDependencies, missingDependencies } = + factoryResult; + if (fileDependencies) { + this.fileDependencies.addAll(fileDependencies); + } + if (contextDependencies) { + this.contextDependencies.addAll(contextDependencies); + } + if (missingDependencies) { + this.missingDependencies.addAll(missingDependencies); + } + }; if (err) { + if (factoryResult) applyFactoryResultDependencies(); if (dependencies.every(d => d.optional)) { this.warnings.push(err); return callback(); @@ -1585,7 +1714,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } } + const newModule = factoryResult.module; + if (!newModule) { + applyFactoryResultDependencies(); return callback(); } @@ -1595,6 +1727,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si this.addModule(newModule, (err, module) => { if (err) { + applyFactoryResultDependencies(); if (!err.module) { err.module = module; } @@ -1603,13 +1736,37 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si return callback(err); } - for (let i = 0; i < dependencies.length; i++) { - const dependency = dependencies[i]; - moduleGraph.setResolvedModule( - connectOrigin ? originModule : null, - dependency, - module - ); + if ( + this._unsafeCache && + factoryResult.cacheable !== false && + /** @type {any} */ (module).restoreFromUnsafeCache && + this._unsafeCachePredicate(module) + ) { + for (let i = 0; i < dependencies.length; i++) { + const dependency = dependencies[i]; + moduleGraph.setResolvedModule( + connectOrigin ? originModule : null, + dependency, + module + ); + unsafeCacheDependencies.set( + dependency, + /** @type {any} */ (module) + ); + } + if (!unsafeCacheData.has(module)) { + unsafeCacheData.set(module, module.getUnsafeCacheData()); + } + } else { + applyFactoryResultDependencies(); + for (let i = 0; i < dependencies.length; i++) { + const dependency = dependencies[i]; + moduleGraph.setResolvedModule( + connectOrigin ? originModule : null, + dependency, + module + ); + } } moduleGraph.setIssuerIfUnset( @@ -1627,99 +1784,89 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } } - // Check for cycles when build is trigger inside another build - let creatingModuleDuringBuildSet = undefined; - if (!recursive && this.buildQueue.isProcessing(originModule)) { - // Track build dependency - creatingModuleDuringBuildSet = - this.creatingModuleDuringBuild.get(originModule); - if (creatingModuleDuringBuildSet === undefined) { - creatingModuleDuringBuildSet = new Set(); - this.creatingModuleDuringBuild.set( - originModule, - creatingModuleDuringBuildSet - ); - } - creatingModuleDuringBuildSet.add(originModule); - - // When building is blocked by another module - // search for a cycle, cancel the cycle by throwing - // an error (otherwise this would deadlock) - const blockReasons = this.creatingModuleDuringBuild.get(module); - if (blockReasons !== undefined) { - const set = new Set(blockReasons); - for (const item of set) { - const blockReasons = this.creatingModuleDuringBuild.get(item); - if (blockReasons !== undefined) { - for (const m of blockReasons) { - if (m === module) { - return callback(new BuildCycleError(module)); - } - set.add(m); - } - } - } - } - } + this._handleModuleBuildAndDependencies( + originModule, + module, + recursive, + callback + ); + }); + } + ); + } - this.buildModule(module, err => { - if (creatingModuleDuringBuildSet !== undefined) { - creatingModuleDuringBuildSet.delete(module); - } - if (err) { - if (!err.module) { - err.module = module; + _handleModuleBuildAndDependencies(originModule, module, recursive, callback) { + // Check for cycles when build is trigger inside another build + let creatingModuleDuringBuildSet = undefined; + if (!recursive && this.buildQueue.isProcessing(originModule)) { + // Track build dependency + creatingModuleDuringBuildSet = + this.creatingModuleDuringBuild.get(originModule); + if (creatingModuleDuringBuildSet === undefined) { + creatingModuleDuringBuildSet = new Set(); + this.creatingModuleDuringBuild.set( + originModule, + creatingModuleDuringBuildSet + ); + } + creatingModuleDuringBuildSet.add(originModule); + + // When building is blocked by another module + // search for a cycle, cancel the cycle by throwing + // an error (otherwise this would deadlock) + const blockReasons = this.creatingModuleDuringBuild.get(module); + if (blockReasons !== undefined) { + const set = new Set(blockReasons); + for (const item of set) { + const blockReasons = this.creatingModuleDuringBuild.get(item); + if (blockReasons !== undefined) { + for (const m of blockReasons) { + if (m === module) { + return callback(new BuildCycleError(module)); } - this.errors.push(err); - - return callback(err); + set.add(m); } + } + } + } + } - if (!recursive) { - this.processModuleDependenciesNonRecursive(module); - callback(null, module); - return; - } + this.buildModule(module, err => { + if (creatingModuleDuringBuildSet !== undefined) { + creatingModuleDuringBuildSet.delete(module); + } + if (err) { + if (!err.module) { + err.module = module; + } + this.errors.push(err); - // This avoids deadlocks for circular dependencies - if (this.processDependenciesQueue.isProcessing(module)) { - return callback(); - } + return callback(err); + } - this.processModuleDependencies(module, err => { - if (err) { - return callback(err); - } - callback(null, module); - }); - }); - }); + if (!recursive) { + this.processModuleDependenciesNonRecursive(module); + callback(null, module); + return; } - ); - } - /** - * @typedef {Object} FactorizeModuleOptions - * @property {ModuleProfile} currentProfile - * @property {ModuleFactory} factory - * @property {Dependency[]} dependencies - * @property {Module | null} originModule - * @property {Partial=} contextInfo - * @property {string=} context - */ + // This avoids deadlocks for circular dependencies + if (this.processDependenciesQueue.isProcessing(module)) { + return callback(); + } - /** - * @param {FactorizeModuleOptions} options options object - * @param {ModuleCallback} callback callback - * @returns {void} - */ - factorizeModule(options, callback) { - this.factorizeQueue.add(options, callback); + this.processModuleDependencies(module, err => { + if (err) { + return callback(err); + } + callback(null, module); + }); + }); } /** * @param {FactorizeModuleOptions} options options object - * @param {ModuleCallback} callback callback + * @param {ModuleOrFactoryResultCallback} callback callback * @returns {void} */ _factorizeModule( @@ -1728,6 +1875,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si factory, dependencies, originModule, + factoryResult, contextInfo, context }, @@ -1761,16 +1909,21 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si module: result }; } - const { fileDependencies, contextDependencies, missingDependencies } = - result; - if (fileDependencies) { - this.fileDependencies.addAll(fileDependencies); - } - if (contextDependencies) { - this.contextDependencies.addAll(contextDependencies); - } - if (missingDependencies) { - this.missingDependencies.addAll(missingDependencies); + if (!factoryResult) { + const { + fileDependencies, + contextDependencies, + missingDependencies + } = result; + if (fileDependencies) { + this.fileDependencies.addAll(fileDependencies); + } + if (contextDependencies) { + this.contextDependencies.addAll(contextDependencies); + } + if (missingDependencies) { + this.missingDependencies.addAll(missingDependencies); + } } } if (err) { @@ -1779,20 +1932,17 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si err, dependencies.map(d => d.loc).filter(Boolean)[0] ); - return callback(notFoundError); + return callback(notFoundError, factoryResult ? result : undefined); } if (!result) { return callback(); } - const newModule = result.module; - if (!newModule) { - return callback(); - } + if (currentProfile !== undefined) { currentProfile.markFactoryEnd(); } - callback(null, newModule); + callback(null, factoryResult ? result : result.module); } ); } @@ -4646,6 +4796,33 @@ This prevents using hashes of each other and should be avoided.`); } } +/** + * @typedef {Object} FactorizeModuleOptions + * @property {ModuleProfile} currentProfile + * @property {ModuleFactory} factory + * @property {Dependency[]} dependencies + * @property {boolean=} factoryResult return full ModuleFactoryResult instead of only module + * @property {Module | null} originModule + * @property {Partial=} contextInfo + * @property {string=} context + */ + +/** + * @param {FactorizeModuleOptions} options options object + * @param {ModuleCallback | ModuleFactoryResultCallback} callback callback + * @returns {void} + */ + +// Workaround for typescript as it doesn't support function overloading in jsdoc within a class +Compilation.prototype.factorizeModule = /** @type {{ + (options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void; + (options: FactorizeModuleOptions & { factoryResult: true }, callback: ModuleFactoryResultCallback): void; +}} */ ( + function (options, callback) { + this.factorizeQueue.add(options, callback); + } +); + // Hide from typescript const compilationPrototype = Compilation.prototype; diff --git a/lib/Compiler.js b/lib/Compiler.js index 4a54f76e0c2..eade25766d6 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -1035,9 +1035,9 @@ ${other}`); return !!this.parentCompilation; } - createCompilation() { + createCompilation(params) { this._cleanupLastCompilation(); - return (this._lastCompilation = new Compilation(this)); + return (this._lastCompilation = new Compilation(this, params)); } /** @@ -1045,7 +1045,7 @@ ${other}`); * @returns {Compilation} the created compilation */ newCompilation(params) { - const compilation = this.createCompilation(); + const compilation = this.createCompilation(params); compilation.name = this.name; compilation.records = this.records; this.hooks.thisCompilation.call(compilation, params); diff --git a/lib/ModuleFactory.js b/lib/ModuleFactory.js index dab8811d7e6..0cc084c0615 100644 --- a/lib/ModuleFactory.js +++ b/lib/ModuleFactory.js @@ -15,6 +15,7 @@ * @property {Set=} fileDependencies * @property {Set=} contextDependencies * @property {Set=} missingDependencies + * @property {boolean=} cacheable allow to use the unsafe cache */ /** diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index cc233876d44..9a1b22519e4 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -167,12 +167,6 @@ const deprecationChangedHookMessage = (name, hook) => { ); }; -/** @type {WeakMap} */ -const unsafeCacheDependencies = new WeakMap(); - -/** @type {WeakMap} */ -const unsafeCacheData = new WeakMap(); - const ruleSetCompiler = new RuleSetCompiler([ new BasicMatcherRulePlugin("test", "resource"), new BasicMatcherRulePlugin("scheme"), @@ -256,11 +250,6 @@ class NormalModuleFactory extends ModuleFactory { rules: options.rules } ]); - this.unsafeCache = !!options.unsafeCache; - this.cachePredicate = - typeof options.unsafeCache === "function" - ? options.unsafeCache - : () => true; this.context = context || ""; this.fs = fs; this._globalParserOptions = options.parser; @@ -745,18 +734,6 @@ class NormalModuleFactory extends ModuleFactory { */ create(data, callback) { const dependencies = /** @type {ModuleDependency[]} */ (data.dependencies); - if (this.unsafeCache) { - const cacheEntry = unsafeCacheDependencies.get(dependencies[0]); - if (cacheEntry) { - const { module } = cacheEntry; - if (!this._restoredUnsafeCacheEntries.has(module)) { - const data = unsafeCacheData.get(module); - module.restoreFromUnsafeCache(data, this); - this._restoredUnsafeCacheEntries.add(module); - } - return callback(null, cacheEntry); - } - } const context = data.context || this.context; const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS; const dependency = dependencies[0]; @@ -788,7 +765,8 @@ class NormalModuleFactory extends ModuleFactory { return callback(err, { fileDependencies, missingDependencies, - contextDependencies + contextDependencies, + cacheable: false }); } @@ -797,7 +775,8 @@ class NormalModuleFactory extends ModuleFactory { return callback(null, { fileDependencies, missingDependencies, - contextDependencies + contextDependencies, + cacheable: resolveData.cacheable }); } @@ -814,7 +793,8 @@ class NormalModuleFactory extends ModuleFactory { return callback(err, { fileDependencies, missingDependencies, - contextDependencies + contextDependencies, + cacheable: false }); } @@ -822,25 +802,10 @@ class NormalModuleFactory extends ModuleFactory { module, fileDependencies, missingDependencies, - contextDependencies + contextDependencies, + cacheable: resolveData.cacheable }; - if ( - this.unsafeCache && - resolveData.cacheable && - module && - module.restoreFromUnsafeCache && - this.cachePredicate(module) - ) { - for (const d of dependencies) { - unsafeCacheDependencies.set(d, factoryResult); - } - if (!unsafeCacheData.has(module)) { - unsafeCacheData.set(module, module.getUnsafeCacheData()); - } - this._restoredUnsafeCacheEntries.add(module); - } - callback(null, factoryResult); }); }); diff --git a/types.d.ts b/types.d.ts index dd1431f3d9e..d00da846c9c 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1299,7 +1299,7 @@ declare class Compilation { /** * Creates an instance of Compilation. */ - constructor(compiler: Compiler); + constructor(compiler: Compiler, params: CompilationParams); hooks: Readonly<{ buildModule: SyncHook<[Module]>; rebuildModule: SyncHook<[Module]>; @@ -1455,6 +1455,7 @@ declare class Compilation { outputOptions: OutputNormalized; bail: boolean; profile: boolean; + params: CompilationParams; mainTemplate: MainTemplate; chunkTemplate: ChunkTemplate; runtimeTemplate: RuntimeTemplate; @@ -1465,7 +1466,11 @@ declare class Compilation { codeGenerationResults: CodeGenerationResults; processDependenciesQueue: AsyncQueue; addModuleQueue: AsyncQueue; - factorizeQueue: AsyncQueue; + factorizeQueue: AsyncQueue< + FactorizeModuleOptions, + string, + Module | ModuleFactoryResult + >; buildQueue: AsyncQueue; rebuildQueue: AsyncQueue; @@ -1548,10 +1553,6 @@ declare class Compilation { __0: HandleModuleCreationOptions, callback: (err?: WebpackError, result?: Module) => void ): void; - factorizeModule( - options: FactorizeModuleOptions, - callback: (err?: WebpackError, result?: Module) => void - ): void; addModuleChain( context: string, dependency: Dependency, @@ -1718,6 +1719,16 @@ declare class Compilation { callback: (err?: WebpackError, result?: ExecuteModuleResult) => void ): void; checkConstraints(): void; + factorizeModule: { + ( + options: FactorizeModuleOptions & { factoryResult?: false }, + callback: (err?: WebpackError, result?: Module) => void + ): void; + ( + options: FactorizeModuleOptions & { factoryResult: true }, + callback: (err?: WebpackError, result?: ModuleFactoryResult) => void + ): void; + }; /** * Add additional assets to the compilation. @@ -1923,7 +1934,7 @@ declare class Compiler { plugins?: WebpackPluginInstance[] ): Compiler; isChild(): boolean; - createCompilation(): Compilation; + createCompilation(params?: any): Compilation; newCompilation(params: CompilationParams): Compilation; createNormalModuleFactory(): NormalModuleFactory; createContextModuleFactory(): ContextModuleFactory; @@ -3824,6 +3835,11 @@ declare interface FactorizeModuleOptions { currentProfile: ModuleProfile; factory: ModuleFactory; dependencies: Dependency[]; + + /** + * return full ModuleFactoryResult instead of only module + */ + factoryResult?: boolean; originModule: null | Module; contextInfo?: Partial; context?: string; @@ -6551,6 +6567,11 @@ declare interface ModuleFactoryResult { fileDependencies?: Set; contextDependencies?: Set; missingDependencies?: Set; + + /** + * allow to use the unsafe cache + */ + cacheable?: boolean; } declare class ModuleFederationPlugin { constructor(options: ModuleFederationPluginOptions); @@ -7371,8 +7392,6 @@ declare abstract class NormalModuleFactory extends ModuleFactory { }>; resolverFactory: ResolverFactory; ruleSet: RuleSet; - unsafeCache: boolean; - cachePredicate: Function; context: string; fs: InputFileSystem; parserCache: Map>; From 8ef452a5b813986ce95b590fc2d51ec510a7ca3c Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 28 Sep 2021 10:19:22 +0200 Subject: [PATCH 31/34] disable unsafeCache in test case as changes won't be detected otherwise --- .../cache-dependencies/managed-items/webpack.config.js | 5 ++++- .../watchCases/snapshot/unable-to-snapshot/webpack.config.js | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/configCases/cache-dependencies/managed-items/webpack.config.js b/test/configCases/cache-dependencies/managed-items/webpack.config.js index a39582ccf43..e79abba3493 100644 --- a/test/configCases/cache-dependencies/managed-items/webpack.config.js +++ b/test/configCases/cache-dependencies/managed-items/webpack.config.js @@ -23,5 +23,8 @@ module.exports = { expect(fileDeps).toContain(path.resolve(__dirname, "index.js")); }); } - ] + ], + module: { + unsafeCache: false + } }; diff --git a/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js b/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js index 49aa73848d3..8021c4c8df4 100644 --- a/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js +++ b/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js @@ -6,5 +6,8 @@ module.exports = (env, { srcPath }) => ({ }, snapshot: { managedPaths: [path.resolve(srcPath, "node_modules")] + }, + module: { + unsafeCache: false } }); From daa2c3808e57723d7a569688081f75ceef2fd9b2 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 28 Sep 2021 15:33:04 +0200 Subject: [PATCH 32/34] lazy assign connections to dependencies in many cases we don't need the assignment --- lib/ModuleGraph.js | 60 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index ce371bfa935..33b5f981b25 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -79,6 +79,8 @@ class ModuleGraphModule { this.profile = undefined; /** @type {boolean} */ this.async = false; + /** @type {ModuleGraphConnection[]} */ + this._unassignedConnections = undefined; } } @@ -169,14 +171,21 @@ class ModuleGraph { dependency.weak, dependency.getCondition(this) ); - this._dependencyMap.set(dependency, connection); const connections = this._getModuleGraphModule(module).incomingConnections; connections.add(connection); - const mgm = this._getModuleGraphModule(originModule); - if (mgm.outgoingConnections === undefined) { - mgm.outgoingConnections = new Set(); + if (originModule) { + const mgm = this._getModuleGraphModule(originModule); + if (mgm._unassignedConnections === undefined) { + mgm._unassignedConnections = []; + } + mgm._unassignedConnections.push(connection); + if (mgm.outgoingConnections === undefined) { + mgm.outgoingConnections = new Set(); + } + mgm.outgoingConnections.add(connection); + } else { + this._dependencyMap.set(dependency, connection); } - mgm.outgoingConnections.add(connection); } /** @@ -185,7 +194,7 @@ class ModuleGraph { * @returns {void} */ updateModule(dependency, module) { - const connection = this._dependencyMap.get(dependency); + const connection = this.getConnection(dependency); if (connection.module === module) return; const newConnection = connection.clone(); newConnection.module = module; @@ -202,12 +211,12 @@ class ModuleGraph { * @returns {void} */ removeConnection(dependency) { - const connection = this._dependencyMap.get(dependency); + const connection = this.getConnection(dependency); const targetMgm = this._getModuleGraphModule(connection.module); targetMgm.incomingConnections.delete(connection); const originMgm = this._getModuleGraphModule(connection.originModule); originMgm.outgoingConnections.delete(connection); - this._dependencyMap.delete(dependency); + this._dependencyMap.set(dependency, null); } /** @@ -216,7 +225,7 @@ class ModuleGraph { * @returns {void} */ addExplanation(dependency, explanation) { - const connection = this._dependencyMap.get(dependency); + const connection = this.getConnection(dependency); connection.addExplanation(explanation); } @@ -342,7 +351,7 @@ class ModuleGraph { * @returns {Module} the referenced module */ getResolvedModule(dependency) { - const connection = this._dependencyMap.get(dependency); + const connection = this.getConnection(dependency); return connection !== undefined ? connection.resolvedModule : null; } @@ -352,7 +361,30 @@ class ModuleGraph { */ getConnection(dependency) { const connection = this._dependencyMap.get(dependency); - return connection; + if (connection === undefined) { + const module = this.getParentModule(dependency); + if (module !== undefined) { + const mgm = this._getModuleGraphModule(module); + if ( + mgm._unassignedConnections && + mgm._unassignedConnections.length !== 0 + ) { + let foundConnection; + for (const connection of mgm._unassignedConnections) { + this._dependencyMap.set(connection.dependency, connection); + if (connection.dependency === dependency) + foundConnection = connection; + } + mgm._unassignedConnections.length = 0; + if (foundConnection !== undefined) { + return foundConnection; + } + } + } + this._dependencyMap.set(dependency, null); + return undefined; + } + return connection === null ? undefined : connection; } /** @@ -360,7 +392,7 @@ class ModuleGraph { * @returns {Module} the referenced module */ getModule(dependency) { - const connection = this._dependencyMap.get(dependency); + const connection = this.getConnection(dependency); return connection !== undefined ? connection.module : null; } @@ -369,7 +401,7 @@ class ModuleGraph { * @returns {Module} the referencing module */ getOrigin(dependency) { - const connection = this._dependencyMap.get(dependency); + const connection = this.getConnection(dependency); return connection !== undefined ? connection.originModule : null; } @@ -378,7 +410,7 @@ class ModuleGraph { * @returns {Module} the original referencing module */ getResolvedOrigin(dependency) { - const connection = this._dependencyMap.get(dependency); + const connection = this.getConnection(dependency); return connection !== undefined ? connection.resolvedOriginModule : null; } From 9e4c259cce6301697c7e82c99c23bf0b502f7ecb Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 28 Sep 2021 17:25:31 +0200 Subject: [PATCH 33/34] fix some cases where undefined modules are used --- .../CommonJsExportRequireDependency.js | 20 ++++++++++--------- .../CommonJsFullRequireDependency.js | 20 ++++++++++--------- lib/dependencies/HarmonyImportDependency.js | 5 ++++- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/lib/dependencies/CommonJsExportRequireDependency.js b/lib/dependencies/CommonJsExportRequireDependency.js index 2facb698164..288e1012635 100644 --- a/lib/dependencies/CommonJsExportRequireDependency.js +++ b/lib/dependencies/CommonJsExportRequireDependency.js @@ -340,15 +340,17 @@ CommonJsExportRequireDependency.Template = class CommonJsExportRequireDependency weak: dep.weak, runtimeRequirements }); - const ids = dep.getIds(moduleGraph); - const usedImported = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime); - if (usedImported) { - const comment = equals(usedImported, ids) - ? "" - : Template.toNormalComment(propertyAccess(ids)) + " "; - requireExpr += `${comment}${propertyAccess(usedImported)}`; + if (importedModule) { + const ids = dep.getIds(moduleGraph); + const usedImported = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime); + if (usedImported) { + const comment = equals(usedImported, ids) + ? "" + : Template.toNormalComment(propertyAccess(ids)) + " "; + requireExpr += `${comment}${propertyAccess(usedImported)}`; + } } switch (type) { diff --git a/lib/dependencies/CommonJsFullRequireDependency.js b/lib/dependencies/CommonJsFullRequireDependency.js index 4c5e71d9384..2c0c9677a64 100644 --- a/lib/dependencies/CommonJsFullRequireDependency.js +++ b/lib/dependencies/CommonJsFullRequireDependency.js @@ -108,15 +108,17 @@ CommonJsFullRequireDependency.Template = class CommonJsFullRequireDependencyTemp weak: dep.weak, runtimeRequirements }); - const ids = dep.names; - const usedImported = moduleGraph - .getExportsInfo(importedModule) - .getUsedName(ids, runtime); - if (usedImported) { - const comment = equals(usedImported, ids) - ? "" - : Template.toNormalComment(propertyAccess(ids)) + " "; - requireExpr += `${comment}${propertyAccess(usedImported)}`; + if (importedModule) { + const ids = dep.names; + const usedImported = moduleGraph + .getExportsInfo(importedModule) + .getUsedName(ids, runtime); + if (usedImported) { + const comment = equals(usedImported, ids) + ? "" + : Template.toNormalComment(propertyAccess(ids)) + " "; + requireExpr += `${comment}${propertyAccess(usedImported)}`; + } } source.replace(dep.range[0], dep.range[1] - 1, requireExpr); } diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js index def765c9ab3..74843153d6f 100644 --- a/lib/dependencies/HarmonyImportDependency.js +++ b/lib/dependencies/HarmonyImportDependency.js @@ -282,7 +282,10 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends } const importStatement = dep.getImportStatement(false, templateContext); - if (templateContext.moduleGraph.isAsync(referencedModule)) { + if ( + referencedModule && + templateContext.moduleGraph.isAsync(referencedModule) + ) { templateContext.initFragments.push( new ConditionalInitFragment( importStatement[0], From 5db30851c7ed007d8f94150ee2c6a1b47d10d388 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 28 Sep 2021 19:39:39 +0200 Subject: [PATCH 34/34] 5.55.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 116eb31a07f..89f1b834b5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack", - "version": "5.54.0", + "version": "5.55.0", "author": "Tobias Koppers @sokra", "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", "license": "MIT",