Unverified Commit ecd31ab6 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

update webpack (#29870)

parent 541259d9
......@@ -38,7 +38,7 @@ module.exports = JSON.parse("{\"application/1d-interleaved-parityfec\":{\"source
/***/ (function(module) {
"use strict";
module.exports = {"i8":"5.58.1"};
module.exports = {"i8":"5.58.2"};
/***/ }),
......@@ -26832,10 +26832,10 @@ const byLocation = compareSelect(err => err.loc, compareLocations);
const compareErrors = concatComparators(byModule, byLocation, byMessage);
/** @type {WeakMap<Dependency, Module & { restoreFromUnsafeCache: Function }>} */
/** @type {WeakMap<Dependency, Module & { restoreFromUnsafeCache: Function } | null>} */
const unsafeCacheDependencies = new WeakMap();
/** @type {WeakMap<Module, object>} */
/** @type {WeakMap<Module & { restoreFromUnsafeCache: Function }, object>} */
const unsafeCacheData = new WeakMap();
class Compilation {
......@@ -27439,8 +27439,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.usedModuleIds = null;
/** @type {boolean} */
this.needAdditionalPass = false;
/** @type {Set<Module>} */
this._restoredUnsafeCacheEntries = new Set();
/** @type {Set<Module & { restoreFromUnsafeCache: Function }>} */
this._restoredUnsafeCacheModuleEntries = new Set();
/** @type {Map<string, Module & { restoreFromUnsafeCache: Function }>} */
this._restoredUnsafeCacheEntries = new Map();
/** @type {WeakSet<Module>} */
this.builtModules = new WeakSet();
/** @type {WeakSet<Module>} */
......@@ -27840,9 +27842,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @returns {void}
*/
_processModuleDependencies(module, callback) {
/**
* @type {Array<{factory: ModuleFactory, dependencies: Dependency[], originModule: Module|null}>}
*/
/** @type {Array<{factory: ModuleFactory, dependencies: Dependency[], originModule: Module|null}>} */
const sortedDependencies = [];
/** @type {DependenciesBlock} */
......@@ -27863,7 +27863,46 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/** @type {Dependency[]} */
let listCacheValue;
const unsafeRestoredModules = new Set();
let inProgressSorting = 1;
let inProgressTransitive = 1;
const onDependenciesSorted = err => {
if (err) return callback(err);
// early exit without changing parallelism back and forth
if (sortedDependencies.length === 0 && inProgressTransitive === 1) {
return callback();
}
// This is nested so we need to allow one additional task
this.processDependenciesQueue.increaseParallelism();
for (const item of sortedDependencies) {
inProgressTransitive++;
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) {
if (inProgressTransitive <= 0) return;
inProgressTransitive = -1;
// eslint-disable-next-line no-self-assign
err.stack = err.stack;
onTransitiveTasksFinished(err);
return;
}
if (--inProgressTransitive === 0) onTransitiveTasksFinished();
});
}
if (--inProgressTransitive === 0) onTransitiveTasksFinished();
};
const onTransitiveTasksFinished = err => {
if (err) return callback(err);
this.processDependenciesQueue.decreaseParallelism();
return callback();
};
/**
* @param {Dependency} dep dependency
......@@ -27874,34 +27913,111 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.moduleGraph.setParents(dep, currentBlock, module, index);
if (this._unsafeCache) {
try {
const cachedModule = unsafeCacheDependencies.get(dep);
if (cachedModule === null) return;
const unsafeCachedModule = unsafeCacheDependencies.get(dep);
if (unsafeCachedModule === null) return;
if (unsafeCachedModule !== undefined) {
if (
this._restoredUnsafeCacheModuleEntries.has(unsafeCachedModule)
) {
this._handleExistingModuleFromUnsafeCache(
module,
dep,
unsafeCachedModule
);
return;
}
const identifier = unsafeCachedModule.identifier();
const cachedModule =
this._restoredUnsafeCacheEntries.get(identifier);
if (cachedModule !== undefined) {
if (!this._restoredUnsafeCacheEntries.has(cachedModule)) {
// update unsafe cache to new module
unsafeCacheDependencies.set(dep, cachedModule);
this._handleExistingModuleFromUnsafeCache(
module,
dep,
cachedModule
);
return;
}
inProgressSorting++;
this._modulesCache.get(identifier, null, (err, cachedModule) => {
if (err) {
if (inProgressSorting <= 0) return;
inProgressSorting = -1;
onDependenciesSorted(err);
return;
}
try {
if (!this._restoredUnsafeCacheEntries.has(identifier)) {
const data = unsafeCacheData.get(cachedModule);
if (data === undefined) {
processDependencyForResolving(dep);
if (--inProgressSorting === 0) onDependenciesSorted();
return;
}
if (cachedModule !== unsafeCachedModule) {
unsafeCacheDependencies.set(dep, cachedModule);
}
cachedModule.restoreFromUnsafeCache(
data,
this.params.normalModuleFactory,
this.params
);
this._restoredUnsafeCacheEntries.add(cachedModule);
this._restoredUnsafeCacheEntries.set(
identifier,
cachedModule
);
this._restoredUnsafeCacheModuleEntries.add(cachedModule);
if (!this.modules.has(cachedModule)) {
this._handleNewModuleFromUnsafeCache(module, dep, cachedModule);
unsafeRestoredModules.add(cachedModule);
inProgressTransitive++;
this._handleNewModuleFromUnsafeCache(
module,
dep,
cachedModule,
err => {
if (err) {
if (inProgressTransitive <= 0) return;
inProgressTransitive = -1;
onTransitiveTasksFinished(err);
}
if (--inProgressTransitive === 0)
return onTransitiveTasksFinished();
}
);
if (--inProgressSorting === 0) onDependenciesSorted();
return;
}
}
if (unsafeCachedModule !== cachedModule) {
unsafeCacheDependencies.set(dep, cachedModule);
}
this._handleExistingModuleFromUnsafeCache(
module,
dep,
cachedModule
);
); // a3
} catch (err) {
if (inProgressSorting <= 0) return;
inProgressSorting = -1;
onDependenciesSorted(err);
return;
}
if (--inProgressSorting === 0) onDependenciesSorted();
});
return;
}
} catch (e) {
console.error(e);
}
}
processDependencyForResolving(dep);
};
/**
* @param {Dependency} dep dependency
* @returns {void}
*/
const processDependencyForResolving = dep => {
const resourceIdent = dep.getResourceIdentifier();
if (resourceIdent !== undefined && resourceIdent !== null) {
const category = dep.category;
......@@ -27986,68 +28102,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
return callback(e);
}
if (sortedDependencies.length === 0 && unsafeRestoredModules.size === 0) {
callback();
return;
if (--inProgressSorting === 0) onDependenciesSorted();
}
// This is nested so we need to allow one additional task
this.processDependenciesQueue.increaseParallelism();
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();
});
};
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) {
_handleNewModuleFromUnsafeCache(originModule, dependency, module, callback) {
const moduleGraph = this.moduleGraph;
moduleGraph.setResolvedModule(originModule, dependency, module);
......@@ -28060,6 +28118,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this._modules.set(module.identifier(), module);
this.modules.add(module);
ModuleGraph.setModuleGraphForModule(module, this.moduleGraph);
this._handleModuleBuildAndDependencies(
originModule,
module,
true,
callback
);
}
_handleExistingModuleFromUnsafeCache(originModule, dependency, module) {
......@@ -28163,20 +28228,24 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/** @type {any} */ (module).restoreFromUnsafeCache &&
this._unsafeCachePredicate(module)
) {
const unsafeCacheableModule =
/** @type {Module & { restoreFromUnsafeCache: Function }} */ (
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)
unsafeCacheableModule
);
unsafeCacheDependencies.set(dependency, unsafeCacheableModule);
}
if (!unsafeCacheData.has(module)) {
unsafeCacheData.set(module, module.getUnsafeCacheData());
if (!unsafeCacheData.has(unsafeCacheableModule)) {
unsafeCacheData.set(
unsafeCacheableModule,
unsafeCacheableModule.getUnsafeCacheData()
);
}
} else {
applyFactoryResultDependencies();
......@@ -31260,7 +31329,7 @@ This prevents using hashes of each other and should be avoided.`);
strictModuleErrorHandling,
strictModuleExceptionHandling
} = this.outputOptions;
const __nested_webpack_require_147787__ = id => {
const __nested_webpack_require_150365__ = id => {
const cached = moduleCache[id];
if (cached !== undefined) {
if (cached.error) throw cached.error;
......@@ -31269,20 +31338,20 @@ This prevents using hashes of each other and should be avoided.`);
const moduleArgument = moduleArgumentsById.get(id);
return __webpack_require_module__(moduleArgument, id);
};
const interceptModuleExecution = (__nested_webpack_require_147787__[
const interceptModuleExecution = (__nested_webpack_require_150365__[
RuntimeGlobals.interceptModuleExecution.replace(
"__webpack_require__.",
""
)
] = []);
const moduleCache = (__nested_webpack_require_147787__[
const moduleCache = (__nested_webpack_require_150365__[
RuntimeGlobals.moduleCache.replace(
"__webpack_require__.",
""
)
] = {});
context.__webpack_require__ = __nested_webpack_require_147787__;
context.__webpack_require__ = __nested_webpack_require_150365__;
/**
* @param {ExecuteModuleArgument} moduleArgument the module argument
......@@ -31298,7 +31367,7 @@ This prevents using hashes of each other and should be avoided.`);
loaded: false,
error: undefined
},
require: __nested_webpack_require_147787__
require: __nested_webpack_require_150365__
};
interceptModuleExecution.forEach(handler =>
handler(execOptions)
......@@ -31338,7 +31407,7 @@ This prevents using hashes of each other and should be avoided.`);
moduleArgumentsMap.get(runtimeModule)
);
}
exports = __nested_webpack_require_147787__(module.identifier());
exports = __nested_webpack_require_150365__(module.identifier());
} catch (e) {
const err = new WebpackError(
`Execution of module code from module graph (${module.readableIdentifier(
......@@ -41027,17 +41096,17 @@ class Snapshot {
this._flags = 0;
/** @type {number | undefined} */
this.startTime = undefined;
/** @type {Map<string, FileSystemInfoEntry> | undefined} */
/** @type {Map<string, FileSystemInfoEntry | null> | undefined} */
this.fileTimestamps = undefined;
/** @type {Map<string, string> | undefined} */
/** @type {Map<string, string | null> | undefined} */
this.fileHashes = undefined;
/** @type {Map<string, TimestampAndHash | string> | undefined} */
/** @type {Map<string, TimestampAndHash | string | null> | undefined} */
this.fileTshs = undefined;
/** @type {Map<string, ResolvedContextFileSystemInfoEntry> | undefined} */
/** @type {Map<string, ResolvedContextFileSystemInfoEntry | null> | undefined} */
this.contextTimestamps = undefined;
/** @type {Map<string, string> | undefined} */
/** @type {Map<string, string | null> | undefined} */
this.contextHashes = undefined;
/** @type {Map<string, ResolvedContextTimestampAndHash> | undefined} */
/** @type {Map<string, ResolvedContextTimestampAndHash | null> | undefined} */
this.contextTshs = undefined;
/** @type {Map<string, boolean> | undefined} */
this.missingExistence = undefined;
......@@ -41644,11 +41713,10 @@ const getManagedItem = (managedPath, path) => {
/**
* @template {ContextFileSystemInfoEntry | ContextTimestampAndHash} T
* @param {T | "ignore"} entry entry
* @param {T} entry entry
* @returns {T["resolved"] | undefined} the resolved entry
*/
const getResolvedTimestamp = entry => {
if (entry === "ignore") return undefined;
if (entry === null) return null;
if (entry.resolved !== undefined) return entry.resolved;
return entry.symlinks === undefined ? entry : undefined;
......@@ -42012,6 +42080,7 @@ class FileSystemInfo {
getContextTimestamp(path, callback) {
const cache = this._contextTimestamps.get(path);
if (cache !== undefined) {
if (cache === "ignore") return callback(null, "ignore");
const resolved = getResolvedTimestamp(cache);
if (resolved !== undefined) return callback(null, resolved);
return this._resolveContextTimestamp(cache, callback);
......@@ -42697,17 +42766,17 @@ class FileSystemInfo {
* @returns {void}
*/
createSnapshot(startTime, files, directories, missing, options, callback) {
/** @type {Map<string, FileSystemInfoEntry>} */
/** @type {Map<string, FileSystemInfoEntry | null>} */
const fileTimestamps = new Map();
/** @type {Map<string, string>} */
/** @type {Map<string, string | null>} */
const fileHashes = new Map();
/** @type {Map<string, TimestampAndHash | string>} */
/** @type {Map<string, TimestampAndHash | string | null>} */
const fileTshs = new Map();
/** @type {Map<string, FileSystemInfoEntry>} */
/** @type {Map<string, FileSystemInfoEntry | null>} */
const contextTimestamps = new Map();
/** @type {Map<string, string>} */
/** @type {Map<string, string | null>} */
const contextHashes = new Map();
/** @type {Map<string, TimestampAndHash | string>} */
/** @type {Map<string, ResolvedContextTimestampAndHash | null>} */
const contextTshs = new Map();
/** @type {Map<string, boolean>} */
const missingExistence = new Map();
......@@ -42901,6 +42970,7 @@ class FileSystemInfo {
this._contextTshsOptimization.optimize(snapshot, capturedDirectories);
for (const path of capturedDirectories) {
const cache = this._contextTshs.get(path);
/** @type {ResolvedContextTimestampAndHash} */
let resolved;
if (
cache !== undefined &&
......@@ -42909,6 +42979,11 @@ class FileSystemInfo {
contextTshs.set(path, resolved);
} else {
jobs++;
/**
* @param {Error=} err error
* @param {ResolvedContextTimestampAndHash=} entry entry
* @returns {void}
*/
const callback = (err, entry) => {
if (err) {
if (this.logger) {
......@@ -42973,14 +43048,20 @@ class FileSystemInfo {
);
for (const path of capturedDirectories) {
const cache = this._contextTimestamps.get(path);
if (cache === "ignore") continue;
let resolved;
if (
cache !== undefined &&
(resolved = getResolvedTimestamp(cache)) !== undefined
) {
contextTimestamps.set(path, resolved);
} else if (cache !== "ignore") {
} else {
jobs++;
/**
* @param {Error=} err error
* @param {ResolvedContextFileSystemInfoEntry=} entry entry
* @returns {void}
*/
const callback = (err, entry) => {
if (err) {
if (this.logger) {
......@@ -43393,14 +43474,14 @@ class FileSystemInfo {
const cache = this._fileTimestamps.get(path);
if (cache !== undefined) {
if (cache === "ignore" || !checkFile(path, cache, tsh, false)) {
processFileHashSnapshot(path, tsh.hash);
processFileHashSnapshot(path, tsh && tsh.hash);
}
} else {
jobs++;
this.fileTimestampQueue.add(path, (err, entry) => {
if (err) return invalidWithError(path, err);
if (!checkFile(path, entry, tsh, false)) {
processFileHashSnapshot(path, tsh.hash);
processFileHashSnapshot(path, tsh && tsh.hash);
}
jobDone();
});
......@@ -43413,6 +43494,7 @@ class FileSystemInfo {
this._statTestedEntries += contextTimestamps.size;
for (const [path, ts] of contextTimestamps) {
const cache = this._contextTimestamps.get(path);
if (cache === "ignore") continue;
let resolved;
if (
cache !== undefined &&
......@@ -43422,8 +43504,13 @@ class FileSystemInfo {
invalid();
return;
}
} else if (cache !== "ignore") {
} else {
jobs++;
/**
* @param {Error=} err error
* @param {ResolvedContextFileSystemInfoEntry=} entry entry
* @returns {void}
*/
const callback = (err, entry) => {
if (err) return invalidWithError(path, err);
if (!checkContext(path, entry, ts)) {
......@@ -43483,27 +43570,33 @@ class FileSystemInfo {
processContextHashSnapshot(path, tsh);
} else {
const cache = this._contextTimestamps.get(path);
if (cache === "ignore") continue;
let resolved;
if (
cache !== undefined &&
(resolved = getResolvedTimestamp(cache)) !== undefined
) {
if (!checkContext(path, resolved, tsh, false)) {
processContextHashSnapshot(path, tsh.hash);
processContextHashSnapshot(path, tsh && tsh.hash);
}
} else if (cache !== "ignore") {
} else {
jobs++;
/**
* @param {Error=} err error
* @param {ResolvedContextFileSystemInfoEntry=} entry entry
* @returns {void}
*/
const callback = (err, entry) => {
if (err) return invalidWithError(path, err);
if (!checkContext(path, entry, tsh, false)) {
processContextHashSnapshot(path, tsh.hash);
processContextHashSnapshot(path, tsh && tsh.hash);
}
jobDone();
};
if (cache !== undefined) {
this._resolveContextTsh(cache, callback);
this._resolveContextTimestamp(cache, callback);
} else {
this.getContextTsh(path, callback);
this.getContextTimestamp(path, callback);
}
}
}
......@@ -43853,6 +43946,11 @@ class FileSystemInfo {
);
}
/**
* @param {ContextFileSystemInfoEntry} entry entry
* @param {function(Error=, ResolvedContextFileSystemInfoEntry=): void} callback callback
* @returns {void}
*/
_resolveContextTimestamp(entry, callback) {
const hashes = [];
let safeTime = 0;
......@@ -43956,6 +44054,11 @@ class FileSystemInfo {
);
}
/**
* @param {ContextHash} entry context hash
* @param {function(Error=, string=): void} callback callback
* @returns {void}
*/
_resolveContextHash(entry, callback) {
const hashes = [];
processAsyncTree(
......@@ -44107,6 +44210,11 @@ class FileSystemInfo {
}
}
/**
* @param {ContextTimestampAndHash} entry entry
* @param {function(Error=, ResolvedContextTimestampAndHash=): void} callback callback
* @returns {void}
*/
_resolveContextTsh(entry, callback) {
const hashes = [];
const tsHashes = [];
......@@ -105507,9 +105615,13 @@ module.exports = class SplitChunksPlugin {
const chunkIndexMap = new Map();
const ZERO = BigInt("0");
const ONE = BigInt("1");
let index = ONE;
const START = ONE << BigInt("31");
let index = START;
for (const chunk of chunks) {
chunkIndexMap.set(chunk, index);
chunkIndexMap.set(
chunk,
index | BigInt((Math.random() * 0x7fffffff) | 0)
);
index = index << ONE;
}
/**
......@@ -105526,7 +105638,8 @@ module.exports = class SplitChunksPlugin {
let key =
chunkIndexMap.get(first) | chunkIndexMap.get(result.value);
while (!(result = iterator.next()).done) {
key = key | chunkIndexMap.get(result.value);
const raw = chunkIndexMap.get(result.value);
key = key ^ raw;
}
return key;
};
......@@ -113315,9 +113428,7 @@ class Serializer {
let current = obj;
for (const middleware of this.serializeMiddlewares) {
if (current && typeof current.then === "function") {
current = current.then(
data => data && middleware.serialize(data, context)
);
current = current.then(data => data && middleware.serialize(data, ctx));
} else if (current) {
try {
current = middleware.serialize(current, ctx);
......@@ -113335,7 +113446,7 @@ class Serializer {
let current = value;
for (const middleware of this.deserializeMiddlewares) {
if (current && typeof current.then === "function") {
current = current.then(data => middleware.deserialize(data, context));
current = current.then(data => middleware.deserialize(data, ctx));
} else {
current = middleware.deserialize(current, ctx);
}
......@@ -249,7 +249,7 @@
"webpack-sources1": "npm:webpack-sources@1.4.3",
"webpack-sources3": "npm:webpack-sources@3.2.0",
"webpack4": "npm:webpack@4.44.1",
"webpack5": "npm:webpack@5.58.1"
"webpack5": "npm:webpack@5.58.2"
},
"resolutions": {
"browserslist": "4.16.6",
......
......@@ -19703,10 +19703,10 @@ webpack-sources@^3.2.0:
watchpack "^1.7.4"
webpack-sources "^1.4.1"
"webpack5@npm:webpack@5.58.1":
version "5.58.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.58.1.tgz#df8aad72b617a9d0db8c89d4f410784ee93320d7"
integrity sha512-4Z/dmbTU+VmkCb2XNgW7wkE5TfEcSooclprn/UEuVeAkwHhn07OcgUsyaKHGtCY/VobjnsYBlyhKeMLiSoOqPg==
"webpack5@npm:webpack@5.58.2":
version "5.58.2"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.58.2.tgz#6b4af12fc9bd5cbedc00dc0a2fc2b9592db16b44"
integrity sha512-3S6e9Vo1W2ijk4F4PPWRIu6D/uGgqaPmqw+av3W3jLDujuNkdxX5h5c+RQ6GkjVR+WwIPOfgY8av+j5j4tMqJw==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.50"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment