chore: udpate prettier to v3
This commit is contained in:
parent
1f45925113
commit
412ae5425e
|
@ -247,7 +247,7 @@ class APIPlugin {
|
|||
? new BasicEvaluatedExpression().setNull()
|
||||
: new BasicEvaluatedExpression().setString(
|
||||
parser.state.module.layer
|
||||
)
|
||||
)
|
||||
).setRange(expr.range)
|
||||
);
|
||||
parser.hooks.evaluateTypeof
|
||||
|
|
|
@ -1539,7 +1539,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
|||
return withConnections
|
||||
? BigInt(
|
||||
`0x${this._getModuleGraphHashWithConnections(cgm, module, runtime)}`
|
||||
)
|
||||
)
|
||||
: this._getModuleGraphHashBigInt(cgm, module, runtime);
|
||||
}
|
||||
|
||||
|
|
|
@ -328,18 +328,18 @@ class CleanPlugin {
|
|||
typeof keep === "function"
|
||||
? keep
|
||||
: typeof keep === "string"
|
||||
? /**
|
||||
* @param {string} path path
|
||||
* @returns {boolean} true, if the path should be kept
|
||||
*/
|
||||
path => path.startsWith(keep)
|
||||
: typeof keep === "object" && keep.test
|
||||
? /**
|
||||
* @param {string} path path
|
||||
* @returns {boolean} true, if the path should be kept
|
||||
*/
|
||||
path => keep.test(path)
|
||||
: () => false;
|
||||
? /**
|
||||
* @param {string} path path
|
||||
* @returns {boolean} true, if the path should be kept
|
||||
*/
|
||||
path => path.startsWith(keep)
|
||||
: typeof keep === "object" && keep.test
|
||||
? /**
|
||||
* @param {string} path path
|
||||
* @returns {boolean} true, if the path should be kept
|
||||
*/
|
||||
path => keep.test(path)
|
||||
: () => false;
|
||||
|
||||
// We assume that no external modification happens while the compiler is active
|
||||
// So we can store the old assets and only diff to them to avoid fs access on
|
||||
|
|
|
@ -1985,8 +1985,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
context: context
|
||||
? context
|
||||
: originModule
|
||||
? originModule.context
|
||||
: this.compiler.context,
|
||||
? originModule.context
|
||||
: this.compiler.context,
|
||||
dependencies: dependencies
|
||||
},
|
||||
(err, result) => {
|
||||
|
@ -2665,9 +2665,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
loaders
|
||||
? `${
|
||||
modules.length
|
||||
} x ${moduleType} with ${this.requestShortener.shorten(
|
||||
} x ${moduleType} with ${this.requestShortener.shorten(
|
||||
loaders
|
||||
)}`
|
||||
)}`
|
||||
: `${modules.length} x ${moduleType}`
|
||||
}`
|
||||
);
|
||||
|
@ -3075,7 +3075,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|||
`BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
|
||||
Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
|
||||
Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.`
|
||||
)
|
||||
)
|
||||
: Object.freeze(this.assets);
|
||||
|
||||
this.summarizeDependencies();
|
||||
|
@ -4582,8 +4582,8 @@ This prevents using hashes of each other and should be avoided.`);
|
|||
(typeof file === "string"
|
||||
? file
|
||||
: typeof filenameTemplate === "string"
|
||||
? filenameTemplate
|
||||
: "");
|
||||
? filenameTemplate
|
||||
: "");
|
||||
|
||||
this.errors.push(new ChunkRenderError(chunk, filename, err));
|
||||
inTry = false;
|
||||
|
@ -4605,7 +4605,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|||
? {
|
||||
...pathAndInfo.info,
|
||||
...fileManifest.info
|
||||
}
|
||||
}
|
||||
: pathAndInfo.info;
|
||||
}
|
||||
|
||||
|
|
|
@ -114,8 +114,8 @@ class ConcatenationScope {
|
|||
const asiSafeFlag = asiSafe
|
||||
? "_asiSafe1"
|
||||
: asiSafe === false
|
||||
? "_asiSafe0"
|
||||
: "";
|
||||
? "_asiSafe0"
|
||||
: "";
|
||||
const exportData = ids
|
||||
? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex")
|
||||
: "ns";
|
||||
|
|
|
@ -509,8 +509,8 @@ class ContextModule extends Module {
|
|||
this.context
|
||||
? [this.context]
|
||||
: typeof this.options.resource === "string"
|
||||
? [this.options.resource]
|
||||
: /** @type {string[]} */ (this.options.resource),
|
||||
? [this.options.resource]
|
||||
: /** @type {string[]} */ (this.options.resource),
|
||||
null,
|
||||
SNAPSHOT_OPTIONS,
|
||||
(err, snapshot) => {
|
||||
|
@ -947,8 +947,8 @@ module.exports = webpackAsyncContext;`;
|
|||
const requestPrefix = hasNoChunk
|
||||
? "Promise.resolve()"
|
||||
: hasMultipleOrNoChunks
|
||||
? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))`
|
||||
: `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`;
|
||||
? `Promise.all(ids.slice(${chunksStartPosition}).map(${RuntimeGlobals.ensureChunk}))`
|
||||
: `${RuntimeGlobals.ensureChunk}(ids[${chunksStartPosition}])`;
|
||||
const returnModuleObject = this.getReturnModuleObjectSource(
|
||||
fakeMap,
|
||||
true,
|
||||
|
|
|
@ -160,7 +160,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
|
|||
resolveOptions || EMPTY_RESOLVE_OPTIONS,
|
||||
"dependencyType",
|
||||
dependencies[0].category
|
||||
)
|
||||
)
|
||||
: resolveOptions
|
||||
);
|
||||
const loaderResolver = this.resolverFactory.get("loader");
|
||||
|
|
|
@ -82,7 +82,7 @@ class EvalDevToolModulePlugin {
|
|||
compilation.outputOptions.trustedTypes
|
||||
? `${RuntimeGlobals.createScript}(${JSON.stringify(
|
||||
content + footer
|
||||
)})`
|
||||
)})`
|
||||
: JSON.stringify(content + footer)
|
||||
});`
|
||||
);
|
||||
|
|
|
@ -182,7 +182,7 @@ class EvalSourceMapDevToolPlugin {
|
|||
compilation.outputOptions.trustedTypes
|
||||
? `${RuntimeGlobals.createScript}(${JSON.stringify(
|
||||
content + footer
|
||||
)})`
|
||||
)})`
|
||||
: JSON.stringify(content + footer)
|
||||
});`
|
||||
)
|
||||
|
|
|
@ -48,12 +48,12 @@ class ExportsInfoApiPlugin {
|
|||
/** @type {Range} */ (expr.range),
|
||||
members.slice(0, -1),
|
||||
members[members.length - 1]
|
||||
)
|
||||
)
|
||||
: new ExportsInfoDependency(
|
||||
/** @type {Range} */ (expr.range),
|
||||
null,
|
||||
members[0]
|
||||
);
|
||||
);
|
||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||
parser.state.module.addDependency(dep);
|
||||
return true;
|
||||
|
|
|
@ -367,7 +367,7 @@ const getSourceForAmdOrUmdExternal = (
|
|||
externalVariable,
|
||||
Array.isArray(request) ? request.join(".") : request,
|
||||
runtimeTemplate
|
||||
)
|
||||
)
|
||||
: undefined,
|
||||
expression: externalVariable
|
||||
};
|
||||
|
@ -581,7 +581,7 @@ class ExternalModule extends Module {
|
|||
? getSourceForCommonJsExternalInNodeModule(
|
||||
request,
|
||||
runtimeTemplate.outputOptions.importMetaName
|
||||
)
|
||||
)
|
||||
: getSourceForCommonJsExternal(request);
|
||||
case "amd":
|
||||
case "amd-require":
|
||||
|
|
|
@ -192,7 +192,7 @@ class ExternalModuleFactoryPlugin {
|
|||
data.resolveOptions || EMPTY_RESOLVE_OPTIONS,
|
||||
"dependencyType",
|
||||
dependencyType
|
||||
)
|
||||
)
|
||||
: data.resolveOptions
|
||||
);
|
||||
if (options) resolver = resolver.withOptions(options);
|
||||
|
|
|
@ -3363,7 +3363,7 @@ class FileSystemInfo {
|
|||
: {
|
||||
...timestamp,
|
||||
...hash
|
||||
};
|
||||
};
|
||||
this._contextTshs.set(path, result);
|
||||
callback(null, result);
|
||||
};
|
||||
|
|
|
@ -246,7 +246,7 @@ class FlagDependencyExportsPlugin {
|
|||
from,
|
||||
fromExport === undefined ? [name] : fromExport,
|
||||
priority
|
||||
))
|
||||
))
|
||||
) {
|
||||
changed = true;
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ class HotModuleReplacementPlugin {
|
|||
: compilation.codeGenerationResults.getHash(
|
||||
module,
|
||||
chunk.runtime
|
||||
);
|
||||
);
|
||||
if (records.chunkModuleHashes[key] !== hash) {
|
||||
updatedModules.add(module, chunk);
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ class HotModuleReplacementPlugin {
|
|||
: compilation.codeGenerationResults.getHash(
|
||||
module,
|
||||
newRuntime
|
||||
);
|
||||
);
|
||||
if (hash !== oldHash) {
|
||||
if (module.type === WEBPACK_MODULE_TYPE_RUNTIME) {
|
||||
newRuntimeModules = newRuntimeModules || [];
|
||||
|
@ -735,7 +735,7 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename
|
|||
Array.from(removedModules, m =>
|
||||
chunkGraph.getModuleId(m)
|
||||
)
|
||||
)
|
||||
)
|
||||
};
|
||||
|
||||
const source = new RawSource(JSON.stringify(hotUpdateMainJson));
|
||||
|
|
|
@ -162,7 +162,7 @@ ModuleFilenameHelpers.createFilename = (
|
|||
? options
|
||||
: {
|
||||
moduleFilenameTemplate: options
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
let absoluteResourcePath;
|
||||
|
|
|
@ -96,7 +96,7 @@ const printExportsInfoToSource = (
|
|||
.map(e => JSON.stringify(e).slice(1, -1))
|
||||
.join(".")}`
|
||||
: ""
|
||||
}`
|
||||
}`
|
||||
: ""
|
||||
}`
|
||||
) + "\n"
|
||||
|
|
|
@ -59,8 +59,8 @@ class MultiStats {
|
|||
...(typeof childOptions === "string"
|
||||
? { preset: childOptions }
|
||||
: childOptions && typeof childOptions === "object"
|
||||
? childOptions
|
||||
: undefined)
|
||||
? childOptions
|
||||
: undefined)
|
||||
},
|
||||
context
|
||||
);
|
||||
|
|
|
@ -132,14 +132,14 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
|
|||
const mapper = !sourceRoot
|
||||
? source => source
|
||||
: sourceRoot.endsWith("/")
|
||||
? source =>
|
||||
source.startsWith("/")
|
||||
? `${sourceRoot.slice(0, -1)}${source}`
|
||||
: `${sourceRoot}${source}`
|
||||
: source =>
|
||||
source.startsWith("/")
|
||||
? `${sourceRoot}${source}`
|
||||
: `${sourceRoot}/${source}`;
|
||||
? source =>
|
||||
source.startsWith("/")
|
||||
? `${sourceRoot.slice(0, -1)}${source}`
|
||||
: `${sourceRoot}${source}`
|
||||
: source =>
|
||||
source.startsWith("/")
|
||||
? `${sourceRoot}${source}`
|
||||
: `${sourceRoot}/${source}`;
|
||||
const newSources = sourceMap.sources.map(source =>
|
||||
contextifySourceUrl(context, mapper(source), associatedObjectForCache)
|
||||
);
|
||||
|
@ -782,7 +782,7 @@ class NormalModule extends Module {
|
|||
currentLoader
|
||||
? compilation.runtimeTemplate.requestShortener.shorten(
|
||||
currentLoader.loader
|
||||
)
|
||||
)
|
||||
: "unknown"
|
||||
}) didn't return a Buffer or String`
|
||||
);
|
||||
|
@ -1205,7 +1205,7 @@ class NormalModule extends Module {
|
|||
const source = this.error
|
||||
? new RawSource(
|
||||
"throw new Error(" + JSON.stringify(this.error.message) + ");"
|
||||
)
|
||||
)
|
||||
: this.generator.generate(this, {
|
||||
dependencyTemplates,
|
||||
runtimeTemplate,
|
||||
|
@ -1218,7 +1218,7 @@ class NormalModule extends Module {
|
|||
codeGenerationResults,
|
||||
getData,
|
||||
type
|
||||
});
|
||||
});
|
||||
|
||||
if (source) {
|
||||
sources.set(type, new CachedSource(source));
|
||||
|
|
|
@ -411,8 +411,8 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
noPreAutoLoaders || noPrePostAutoLoaders
|
||||
? 2
|
||||
: noAutoLoaders
|
||||
? 1
|
||||
: 0
|
||||
? 1
|
||||
: 0
|
||||
)
|
||||
.split(/!+/);
|
||||
unresolvedResource = rawElements.pop();
|
||||
|
@ -676,7 +676,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
resolveOptions || EMPTY_RESOLVE_OPTIONS,
|
||||
"dependencyType",
|
||||
dependencyType
|
||||
)
|
||||
)
|
||||
: resolveOptions
|
||||
);
|
||||
this.resolveResource(
|
||||
|
@ -1063,10 +1063,10 @@ If changing the source code is not an option there is also a resolve options cal
|
|||
const type = /\.mjs$/i.test(parsedResult.path)
|
||||
? "module"
|
||||
: /\.cjs$/i.test(parsedResult.path)
|
||||
? "commonjs"
|
||||
: resolveRequest.descriptionFileData === undefined
|
||||
? undefined
|
||||
: resolveRequest.descriptionFileData.type;
|
||||
? "commonjs"
|
||||
: resolveRequest.descriptionFileData === undefined
|
||||
? undefined
|
||||
: resolveRequest.descriptionFileData.type;
|
||||
|
||||
const resolved = {
|
||||
loader: parsedResult.path,
|
||||
|
|
|
@ -222,7 +222,7 @@ class RuntimeTemplate {
|
|||
? `var [${items.join(", ")}] = ${value};`
|
||||
: Template.asString(
|
||||
items.map((item, i) => `var ${item} = ${value}[${i}];`)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
destructureObject(items, value) {
|
||||
|
@ -230,7 +230,7 @@ class RuntimeTemplate {
|
|||
? `var {${items.join(", ")}} = ${value};`
|
||||
: Template.asString(
|
||||
items.map(item => `var ${item} = ${value}${propertyAccess([item])};`)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
iife(args, body) {
|
||||
|
@ -242,7 +242,7 @@ class RuntimeTemplate {
|
|||
? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}`
|
||||
: `${array}.forEach(function(${variable}) {\n${Template.indent(
|
||||
body
|
||||
)}\n});`;
|
||||
)}\n});`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -343,10 +343,10 @@ class RuntimeTemplate {
|
|||
moduleId === null
|
||||
? JSON.stringify("Module is not available (weak dependency)")
|
||||
: idExpr
|
||||
? `"Module '" + ${idExpr} + "' is not available (weak dependency)"`
|
||||
: JSON.stringify(
|
||||
`Module '${moduleId}' is not available (weak dependency)`
|
||||
);
|
||||
? `"Module '" + ${idExpr} + "' is not available (weak dependency)"`
|
||||
: JSON.stringify(
|
||||
`Module '${moduleId}' is not available (weak dependency)`
|
||||
);
|
||||
const comment = request ? Template.toNormalComment(request) + " " : "";
|
||||
const errorStatements =
|
||||
`var e = new Error(${errorMessage}); ` +
|
||||
|
@ -840,8 +840,8 @@ class RuntimeTemplate {
|
|||
return asiSafe
|
||||
? `(${importVar}_default()${propertyAccess(exportName, 1)})`
|
||||
: asiSafe === false
|
||||
? `;(${importVar}_default()${propertyAccess(exportName, 1)})`
|
||||
: `${importVar}_default.a${propertyAccess(exportName, 1)}`;
|
||||
? `;(${importVar}_default()${propertyAccess(exportName, 1)})`
|
||||
: `${importVar}_default.a${propertyAccess(exportName, 1)}`;
|
||||
}
|
||||
case "default-only":
|
||||
case "default-with-named":
|
||||
|
@ -898,8 +898,8 @@ class RuntimeTemplate {
|
|||
return asiSafe
|
||||
? `(0,${access})`
|
||||
: asiSafe === false
|
||||
? `;(0,${access})`
|
||||
: `/*#__PURE__*/Object(${access})`;
|
||||
? `;(0,${access})`
|
||||
: `/*#__PURE__*/Object(${access})`;
|
||||
}
|
||||
return access;
|
||||
} else {
|
||||
|
|
|
@ -486,7 +486,7 @@ class SourceMapDevToolPlugin {
|
|||
outputFs,
|
||||
`/${options.fileContext}`,
|
||||
`/${filename}`
|
||||
)
|
||||
)
|
||||
: filename,
|
||||
contentHash: sourceMapContentHash
|
||||
};
|
||||
|
@ -501,7 +501,7 @@ class SourceMapDevToolPlugin {
|
|||
outputFs,
|
||||
dirname(outputFs, `/${file}`),
|
||||
`/${sourceMapFile}`
|
||||
);
|
||||
);
|
||||
/** @type {Source} */
|
||||
let asset = new RawSource(source);
|
||||
if (currentSourceMappingURLComment !== false) {
|
||||
|
|
|
@ -329,7 +329,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|||
options.externalsPresets.node ? "node" : "web"
|
||||
}.js`
|
||||
)
|
||||
}),
|
||||
}),
|
||||
entries: !lazyOptions || lazyOptions.entries !== false,
|
||||
imports: !lazyOptions || lazyOptions.imports !== false,
|
||||
test: (lazyOptions && lazyOptions.test) || undefined
|
||||
|
|
|
@ -208,9 +208,8 @@ class AssetModulesPlugin {
|
|||
codeGenResult.data.get("fullContentHash")
|
||||
});
|
||||
} catch (e) {
|
||||
/** @type {Error} */ (
|
||||
e
|
||||
).message += `\nduring rendering of asset ${module.identifier()}`;
|
||||
/** @type {Error} */ (e).message +=
|
||||
`\nduring rendering of asset ${module.identifier()}`;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,11 +199,18 @@ class IdleFileCachePlugin {
|
|||
}s.`
|
||||
);
|
||||
}
|
||||
idleTimer = setTimeout(() => {
|
||||
idleTimer = undefined;
|
||||
isIdle = true;
|
||||
resolvedPromise.then(processIdleTasks);
|
||||
}, Math.min(isInitialStore ? idleTimeoutForInitialStore : Infinity, isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, idleTimeout));
|
||||
idleTimer = setTimeout(
|
||||
() => {
|
||||
idleTimer = undefined;
|
||||
isIdle = true;
|
||||
resolvedPromise.then(processIdleTasks);
|
||||
},
|
||||
Math.min(
|
||||
isInitialStore ? idleTimeoutForInitialStore : Infinity,
|
||||
isLargeChange ? idleTimeoutAfterLargeChanges : Infinity,
|
||||
idleTimeout
|
||||
)
|
||||
);
|
||||
idleTimer.unref();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -539,7 +539,7 @@ class Pack {
|
|||
map.set(identifier, content.content.get(identifier));
|
||||
}
|
||||
return new PackContentItems(map);
|
||||
})
|
||||
})
|
||||
: undefined;
|
||||
}
|
||||
}
|
||||
|
@ -1046,8 +1046,8 @@ class PackFileCacheStrategy {
|
|||
compression === "brotli"
|
||||
? ".pack.br"
|
||||
: compression === "gzip"
|
||||
? ".pack.gz"
|
||||
: ".pack";
|
||||
? ".pack.gz"
|
||||
: ".pack";
|
||||
this.snapshot = snapshot;
|
||||
/** @type {Set<string>} */
|
||||
this.buildDependencies = new Set();
|
||||
|
|
|
@ -264,7 +264,7 @@ class ResolverCachePlugin {
|
|||
yields = undefined;
|
||||
callbacks = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
: (err, result) => {
|
||||
if (callbacks === undefined) {
|
||||
callback(err, result);
|
||||
|
@ -276,7 +276,7 @@ class ResolverCachePlugin {
|
|||
activeRequests.delete(identifier);
|
||||
callbacks = false;
|
||||
}
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @param {Error=} err error if any
|
||||
* @param {CacheEntry=} cacheEntry cache entry
|
||||
|
|
|
@ -60,11 +60,11 @@ const load = (input, context) => {
|
|||
const config = query
|
||||
? query
|
||||
: configPath
|
||||
? browserslist.loadConfig({
|
||||
config: configPath,
|
||||
env
|
||||
})
|
||||
: browserslist.loadConfig({ path: context, env });
|
||||
? browserslist.loadConfig({
|
||||
config: configPath,
|
||||
env
|
||||
})
|
||||
: browserslist.loadConfig({ path: context, env });
|
||||
|
||||
if (!config) return;
|
||||
return browserslist(config);
|
||||
|
|
|
@ -160,11 +160,11 @@ const applyWebpackOptionsDefaults = options => {
|
|||
target === false
|
||||
? /** @type {false} */ (false)
|
||||
: typeof target === "string"
|
||||
? getTargetProperties(target, /** @type {Context} */ (options.context))
|
||||
: getTargetsProperties(
|
||||
/** @type {string[]} */ (target),
|
||||
/** @type {Context} */ (options.context)
|
||||
);
|
||||
? getTargetProperties(target, /** @type {Context} */ (options.context))
|
||||
: getTargetsProperties(
|
||||
/** @type {string[]} */ (target),
|
||||
/** @type {Context} */ (options.context)
|
||||
);
|
||||
|
||||
const development = mode === "development";
|
||||
const production = mode === "production" || !mode;
|
||||
|
@ -262,8 +262,8 @@ const applyWebpackOptionsDefaults = options => {
|
|||
validExternalTypes.includes(options.output.library.type)
|
||||
? /** @type {ExternalsType} */ (options.output.library.type)
|
||||
: options.output.module
|
||||
? "module"
|
||||
: "var";
|
||||
? "module"
|
||||
: "var";
|
||||
});
|
||||
|
||||
applyNodeDefaults(options.node, {
|
||||
|
@ -443,7 +443,7 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => {
|
|||
process.versions.pnp === "3"
|
||||
? [
|
||||
/^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/
|
||||
]
|
||||
]
|
||||
: [/^(.+?[\\/]node_modules[\\/])/]
|
||||
);
|
||||
F(snapshot, "immutablePaths", () =>
|
||||
|
@ -848,9 +848,8 @@ const applyOutputDefaults = (
|
|||
} catch (e) {
|
||||
if (/** @type {Error & { code: string }} */ (e).code !== "ENOENT") {
|
||||
/** @type {Error & { code: string }} */
|
||||
(
|
||||
e
|
||||
).message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
|
||||
(e).message +=
|
||||
`\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
|
||||
throw e;
|
||||
}
|
||||
return "";
|
||||
|
|
|
@ -109,7 +109,7 @@ const keyedNestedConfig = (value, fn, customKeys) => {
|
|||
obj
|
||||
),
|
||||
/** @type {Record<string, R>} */ ({})
|
||||
);
|
||||
);
|
||||
if (customKeys) {
|
||||
for (const key of Object.keys(customKeys)) {
|
||||
if (!(key in result)) {
|
||||
|
@ -183,11 +183,11 @@ const getNormalizedWebpackOptions = config => {
|
|||
config.entry === undefined
|
||||
? { main: {} }
|
||||
: typeof config.entry === "function"
|
||||
? (
|
||||
fn => () =>
|
||||
Promise.resolve().then(fn).then(getNormalizedEntryStatic)
|
||||
)(config.entry)
|
||||
: getNormalizedEntryStatic(config.entry),
|
||||
? (
|
||||
fn => () =>
|
||||
Promise.resolve().then(fn).then(getNormalizedEntryStatic)
|
||||
)(config.entry)
|
||||
: getNormalizedEntryStatic(config.entry),
|
||||
experiments: nestedConfig(config.experiments, experiments => ({
|
||||
...experiments,
|
||||
buildHttp: optionalNestedConfig(experiments.buildHttp, options =>
|
||||
|
@ -224,7 +224,7 @@ const getNormalizedWebpackOptions = config => {
|
|||
}
|
||||
return true;
|
||||
};
|
||||
})
|
||||
})
|
||||
: undefined,
|
||||
infrastructureLogging: cloneObject(config.infrastructureLogging),
|
||||
loader: cloneObject(config.loader),
|
||||
|
@ -289,7 +289,7 @@ const getNormalizedWebpackOptions = config => {
|
|||
? handledDeprecatedNoEmitOnErrors(
|
||||
optimization.noEmitOnErrors,
|
||||
optimization.emitOnErrors
|
||||
)
|
||||
)
|
||||
: optimization.emitOnErrors
|
||||
};
|
||||
}),
|
||||
|
@ -303,10 +303,10 @@ const getNormalizedWebpackOptions = config => {
|
|||
"type" in library
|
||||
? library
|
||||
: libraryAsName || output.libraryTarget
|
||||
? /** @type {LibraryOptions} */ ({
|
||||
name: libraryAsName
|
||||
})
|
||||
: undefined;
|
||||
? /** @type {LibraryOptions} */ ({
|
||||
name: libraryAsName
|
||||
})
|
||||
: undefined;
|
||||
/** @type {OutputNormalized} */
|
||||
const result = {
|
||||
assetModuleFilename: output.assetModuleFilename,
|
||||
|
|
|
@ -113,7 +113,7 @@ class ContainerReferencePlugin {
|
|||
? external.slice(9)
|
||||
: `webpack/container/reference/${key}${
|
||||
i ? `/fallback-${i}` : ""
|
||||
}`
|
||||
}`
|
||||
),
|
||||
`.${data.request.slice(key.length)}`,
|
||||
config.shareScope
|
||||
|
|
|
@ -129,7 +129,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
`link.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
|
||||
),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: ""
|
||||
]);
|
||||
|
||||
|
@ -141,7 +141,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
{ expr: "uniqueName" },
|
||||
"-",
|
||||
{ expr: "chunkId" }
|
||||
)
|
||||
)
|
||||
: runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" });
|
||||
|
||||
return Template.asString([
|
||||
|
@ -158,7 +158,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
uniqueName
|
||||
? `var uniqueName = ${JSON.stringify(
|
||||
runtimeTemplate.outputOptions.uniqueName
|
||||
)};`
|
||||
)};`
|
||||
: "// data-webpack is not used as build has no uniqueName",
|
||||
`var loadCssChunkData = ${runtimeTemplate.basicFunction(
|
||||
"target, link, chunkId",
|
||||
|
@ -210,10 +210,10 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
{ expr: "token" },
|
||||
"-",
|
||||
{ expr: "exports[x]" }
|
||||
)
|
||||
)
|
||||
: runtimeTemplate.concatenation({ expr: "token" }, "-", {
|
||||
expr: "exports[x]"
|
||||
})
|
||||
})
|
||||
}`,
|
||||
"x"
|
||||
)}); exportsWithDashes.forEach(${runtimeTemplate.expressionFunction(
|
||||
|
@ -292,18 +292,18 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
initialChunkIdsWithCss.size > 2
|
||||
? `${JSON.stringify(
|
||||
Array.from(initialChunkIdsWithCss)
|
||||
)}.forEach(loadCssChunkData.bind(null, ${
|
||||
)}.forEach(loadCssChunkData.bind(null, ${
|
||||
RuntimeGlobals.moduleFactories
|
||||
}, 0));`
|
||||
}, 0));`
|
||||
: initialChunkIdsWithCss.size > 0
|
||||
? `${Array.from(
|
||||
initialChunkIdsWithCss,
|
||||
id =>
|
||||
`loadCssChunkData(${
|
||||
RuntimeGlobals.moduleFactories
|
||||
}, 0, ${JSON.stringify(id)});`
|
||||
).join("")}`
|
||||
: "// no initial css",
|
||||
? `${Array.from(
|
||||
initialChunkIdsWithCss,
|
||||
id =>
|
||||
`loadCssChunkData(${
|
||||
RuntimeGlobals.moduleFactories
|
||||
}, 0, ${JSON.stringify(id)});`
|
||||
).join("")}`
|
||||
: "// no initial css",
|
||||
"",
|
||||
withLoading
|
||||
? Template.asString([
|
||||
|
@ -372,7 +372,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
]),
|
||||
"}"
|
||||
])};`
|
||||
])
|
||||
])
|
||||
: "// no chunk loading",
|
||||
"",
|
||||
withHmr
|
||||
|
@ -464,7 +464,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
])});`
|
||||
]
|
||||
)}`
|
||||
])
|
||||
])
|
||||
: "// no hmr"
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -601,9 +601,9 @@ class CssModulesPlugin {
|
|||
return v === shortcutValue
|
||||
? `${escapeCss(n)}/`
|
||||
: v === "--" + shortcutValue
|
||||
? `${escapeCss(n)}%`
|
||||
: `${escapeCss(n)}(${escapeCss(v)})`;
|
||||
}).join("")
|
||||
? `${escapeCss(n)}%`
|
||||
: `${escapeCss(n)}(${escapeCss(v)})`;
|
||||
}).join("")
|
||||
: ""
|
||||
}${escapeCss(moduleId)}`
|
||||
);
|
||||
|
|
|
@ -911,7 +911,7 @@ class CssParser extends Parser {
|
|||
) {
|
||||
modeData = balanced[balanced.length - 1]
|
||||
? /** @type {"local" | "global"} */
|
||||
(balanced[balanced.length - 1][0])
|
||||
(balanced[balanced.length - 1][0])
|
||||
: undefined;
|
||||
const dep = new ConstDependency("", [start, end]);
|
||||
module.addPresentationalDependency(dep);
|
||||
|
|
|
@ -374,7 +374,7 @@ const makeInterceptorFor = (instance, tracer) => hookName => ({
|
|||
name,
|
||||
type,
|
||||
fn
|
||||
});
|
||||
});
|
||||
return {
|
||||
...tapInfo,
|
||||
fn: newFn
|
||||
|
|
|
@ -66,7 +66,7 @@ class ContextElementDependency extends ModuleDependency {
|
|||
? this.referencedExports.map(e => ({
|
||||
name: e,
|
||||
canMangle: false
|
||||
}))
|
||||
}))
|
||||
: Dependency.EXPORTS_OBJECT_REFERENCED;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends
|
|||
? HarmonyImportDependency.Template.getImportEmittedRuntime(
|
||||
module,
|
||||
referencedModule
|
||||
)
|
||||
)
|
||||
: false
|
||||
};
|
||||
})
|
||||
|
|
|
@ -31,10 +31,10 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|||
options.reexportExportsPresence !== undefined
|
||||
? ExportPresenceModes.fromUserOption(options.reexportExportsPresence)
|
||||
: options.exportsPresence !== undefined
|
||||
? ExportPresenceModes.fromUserOption(options.exportsPresence)
|
||||
: options.strictExportPresence
|
||||
? ExportPresenceModes.ERROR
|
||||
: ExportPresenceModes.AUTO;
|
||||
? ExportPresenceModes.fromUserOption(options.exportsPresence)
|
||||
: options.strictExportPresence
|
||||
? ExportPresenceModes.ERROR
|
||||
: ExportPresenceModes.AUTO;
|
||||
}
|
||||
|
||||
apply(parser) {
|
||||
|
@ -97,20 +97,20 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|||
expr.type.endsWith("Declaration") && expr.id
|
||||
? expr.id.name
|
||||
: isFunctionDeclaration
|
||||
? {
|
||||
id: expr.id ? expr.id.name : undefined,
|
||||
range: [
|
||||
expr.range[0],
|
||||
expr.params.length > 0
|
||||
? expr.params[0].range[0]
|
||||
: expr.body.range[0]
|
||||
],
|
||||
prefix: `${expr.async ? "async " : ""}function${
|
||||
expr.generator ? "*" : ""
|
||||
} `,
|
||||
suffix: `(${expr.params.length > 0 ? "" : ") "}`
|
||||
}
|
||||
: undefined
|
||||
? {
|
||||
id: expr.id ? expr.id.name : undefined,
|
||||
range: [
|
||||
expr.range[0],
|
||||
expr.params.length > 0
|
||||
? expr.params[0].range[0]
|
||||
: expr.body.range[0]
|
||||
],
|
||||
prefix: `${expr.async ? "async " : ""}function${
|
||||
expr.generator ? "*" : ""
|
||||
} `,
|
||||
suffix: `(${expr.params.length > 0 ? "" : ") "}`
|
||||
}
|
||||
: undefined
|
||||
);
|
||||
dep.loc = Object.create(statement.loc);
|
||||
dep.loc.index = -1;
|
||||
|
|
|
@ -141,10 +141,10 @@ class HarmonyExportInitFragment extends InitFragment {
|
|||
this.unusedExports.size > 1
|
||||
? `/* unused harmony exports ${joinIterableWithComma(
|
||||
this.unusedExports
|
||||
)} */\n`
|
||||
)} */\n`
|
||||
: this.unusedExports.size > 0
|
||||
? `/* unused harmony export ${first(this.unusedExports)} */\n`
|
||||
: "";
|
||||
? `/* unused harmony export ${first(this.unusedExports)} */\n`
|
||||
: "";
|
||||
const definitions = [];
|
||||
const orderedExportMap = Array.from(this.exportMap).sort(([a], [b]) =>
|
||||
a < b ? -1 : 1
|
||||
|
@ -160,7 +160,7 @@ class HarmonyExportInitFragment extends InitFragment {
|
|||
this.exportMap.size > 0
|
||||
? `/* harmony export */ ${RuntimeGlobals.definePropertyGetters}(${
|
||||
this.exportsArgument
|
||||
}, {${definitions.join(",")}\n/* harmony export */ });\n`
|
||||
}, {${definitions.join(",")}\n/* harmony export */ });\n`
|
||||
: "";
|
||||
return `${definePart}${unusedPart}`;
|
||||
}
|
||||
|
|
|
@ -157,8 +157,8 @@ class HarmonyImportDependency extends ModuleDependency {
|
|||
const moreInfo = !Array.isArray(providedExports)
|
||||
? " (possible exports unknown)"
|
||||
: providedExports.length === 0
|
||||
? " (module has no exports)"
|
||||
: ` (possible exports: ${providedExports.join(", ")})`;
|
||||
? " (module has no exports)"
|
||||
: ` (possible exports: ${providedExports.join(", ")})`;
|
||||
return [
|
||||
new HarmonyLinkingError(
|
||||
`export ${ids
|
||||
|
@ -287,8 +287,8 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
|
|||
const runtimeCondition = dep.weak
|
||||
? false
|
||||
: connection
|
||||
? filterRuntime(runtime, r => connection.isTargetActive(r))
|
||||
: true;
|
||||
? filterRuntime(runtime, r => connection.isTargetActive(r))
|
||||
: true;
|
||||
|
||||
if (module && referencedModule) {
|
||||
let emittedModules = importEmittedMap.get(module);
|
||||
|
|
|
@ -75,10 +75,10 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
options.importExportsPresence !== undefined
|
||||
? ExportPresenceModes.fromUserOption(options.importExportsPresence)
|
||||
: options.exportsPresence !== undefined
|
||||
? ExportPresenceModes.fromUserOption(options.exportsPresence)
|
||||
: options.strictExportPresence
|
||||
? ExportPresenceModes.ERROR
|
||||
: ExportPresenceModes.AUTO;
|
||||
? ExportPresenceModes.fromUserOption(options.exportsPresence)
|
||||
: options.strictExportPresence
|
||||
? ExportPresenceModes.ERROR
|
||||
: ExportPresenceModes.AUTO;
|
||||
this.strictThisContextOnImports = options.strictThisContextOnImports;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
? getNonOptionalMemberChain(
|
||||
expression,
|
||||
members.length - nonOptionalMembers.length
|
||||
)
|
||||
)
|
||||
: expression;
|
||||
const ids = settings.ids.concat(nonOptionalMembers);
|
||||
const dep = new HarmonyImportSpecifierDependency(
|
||||
|
@ -286,7 +286,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|||
? getNonOptionalMemberChain(
|
||||
callee,
|
||||
members.length - nonOptionalMembers.length
|
||||
)
|
||||
)
|
||||
: callee;
|
||||
const ids = settings.ids.concat(nonOptionalMembers);
|
||||
const dep = new HarmonyImportSpecifierDependency(
|
||||
|
|
|
@ -28,7 +28,7 @@ const getExportsFromData = data => {
|
|||
canMangle: true,
|
||||
exports: getExportsFromData(item)
|
||||
};
|
||||
})
|
||||
})
|
||||
: undefined;
|
||||
} else {
|
||||
const exports = [];
|
||||
|
|
|
@ -69,7 +69,7 @@ RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate exten
|
|||
`require.include ${runtimeTemplate.requestShortener.shorten(
|
||||
dep.request
|
||||
)}`
|
||||
)
|
||||
)
|
||||
: "";
|
||||
|
||||
source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`);
|
||||
|
|
|
@ -71,7 +71,7 @@ WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate
|
|||
`__webpack_is_included__ ${runtimeTemplate.requestShortener.shorten(
|
||||
dep.request
|
||||
)}`
|
||||
)
|
||||
)
|
||||
: "";
|
||||
|
||||
source.replace(
|
||||
|
|
|
@ -240,7 +240,7 @@ class WorkerPlugin {
|
|||
insertLocation: arg2
|
||||
? /** @type {Range} */ (arg2.range)
|
||||
: /** @type {Range} */ (arg1.range)[1]
|
||||
};
|
||||
};
|
||||
const { options: importOptions, errors: commentErrors } =
|
||||
parser.parseCommentOptions(/** @type {Range} */ (expr.range));
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
]),
|
||||
"}",
|
||||
withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : ""
|
||||
])}`
|
||||
])}`
|
||||
: "// no install chunk",
|
||||
"",
|
||||
withLoading
|
||||
|
@ -222,25 +222,25 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"}"
|
||||
]),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: Template.indent(["installedChunks[chunkId] = 0;"])
|
||||
)};`
|
||||
])
|
||||
])
|
||||
: "// no chunk on demand loading",
|
||||
"",
|
||||
withExternalInstallChunk
|
||||
? Template.asString([
|
||||
`${RuntimeGlobals.externalInstallChunk} = installChunk;`
|
||||
])
|
||||
])
|
||||
: "// no external install chunk",
|
||||
"",
|
||||
withOnChunkLoad
|
||||
? `${
|
||||
RuntimeGlobals.onChunksLoaded
|
||||
}.j = ${runtimeTemplate.returningFunction(
|
||||
}.j = ${runtimeTemplate.returningFunction(
|
||||
"installedChunks[chunkId] === 0",
|
||||
"chunkId"
|
||||
)};`
|
||||
)};`
|
||||
: "// no on chunks loaded"
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -288,8 +288,7 @@ module.exports = function () {
|
|||
updatedModules
|
||||
);
|
||||
return promises;
|
||||
},
|
||||
[])
|
||||
}, [])
|
||||
).then(function () {
|
||||
return waitForBlockingPromises(function () {
|
||||
if (applyOnUpdate) {
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = options => (compiler, callback) => {
|
|||
: (() => {
|
||||
const http = isHttps ? require("https") : require("http");
|
||||
return http.createServer.bind(http, options.server);
|
||||
})();
|
||||
})();
|
||||
const listen =
|
||||
typeof options.listen === "function"
|
||||
? options.listen
|
||||
|
@ -46,7 +46,7 @@ module.exports = options => (compiler, callback) => {
|
|||
if (typeof listen === "object" && !("port" in listen))
|
||||
listen = { ...listen, port: undefined };
|
||||
server.listen(listen);
|
||||
};
|
||||
};
|
||||
|
||||
const protocol = options.protocol || (isHttps ? "https" : "http");
|
||||
|
||||
|
@ -109,8 +109,8 @@ module.exports = options => (compiler, callback) => {
|
|||
addr.address === "::" || addr.address === "0.0.0.0"
|
||||
? `${protocol}://localhost:${addr.port}`
|
||||
: addr.family === "IPv6"
|
||||
? `${protocol}://[${addr.address}]:${addr.port}`
|
||||
: `${protocol}://${addr.address}:${addr.port}`;
|
||||
? `${protocol}://[${addr.address}]:${addr.port}`
|
||||
: `${protocol}://${addr.address}:${addr.port}`;
|
||||
logger.log(
|
||||
`Server-Sent-Events server for lazy compilation open at ${urlBase}.`
|
||||
);
|
||||
|
|
|
@ -66,7 +66,7 @@ class DeterministicModuleIdsPlugin {
|
|||
? () => 0
|
||||
: compareModulesByPreOrderIndexOrIdentifier(
|
||||
compilation.moduleGraph
|
||||
),
|
||||
),
|
||||
(module, id) => {
|
||||
const size = usedIds.size;
|
||||
usedIds.add(`${id}`);
|
||||
|
|
|
@ -679,8 +679,8 @@ class JavascriptModulesPlugin {
|
|||
return strictHeader
|
||||
? new ConcatSource(strictHeader, source, ";")
|
||||
: renderContext.runtimeTemplate.isModule()
|
||||
? source
|
||||
: new ConcatSource(source, ";");
|
||||
? source
|
||||
: new ConcatSource(source, ";");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -751,7 +751,7 @@ class JavascriptModulesPlugin {
|
|||
inlinedModules
|
||||
? allModules.filter(
|
||||
m => !(/** @type {Set<Module>} */ (inlinedModules).has(m))
|
||||
)
|
||||
)
|
||||
: allModules,
|
||||
module => this.renderModule(module, chunkRenderContext, hooks, true),
|
||||
prefix
|
||||
|
@ -837,14 +837,14 @@ class JavascriptModulesPlugin {
|
|||
let iife = innerStrict
|
||||
? "it need to be in strict mode."
|
||||
: inlinedModules.size > 1
|
||||
? // TODO check globals and top-level declarations of other entries and chunk modules
|
||||
// to make a better decision
|
||||
"it need to be isolated against other entry modules."
|
||||
: chunkModules
|
||||
? "it need to be isolated against other modules in the chunk."
|
||||
: exports && !webpackExports
|
||||
? `it uses a non-standard name for the exports (${m.exportsArgument}).`
|
||||
: hooks.embedInRuntimeBailout.call(m, renderContext);
|
||||
? // TODO check globals and top-level declarations of other entries and chunk modules
|
||||
// to make a better decision
|
||||
"it need to be isolated against other entry modules."
|
||||
: chunkModules
|
||||
? "it need to be isolated against other modules in the chunk."
|
||||
: exports && !webpackExports
|
||||
? `it uses a non-standard name for the exports (${m.exportsArgument}).`
|
||||
: hooks.embedInRuntimeBailout.call(m, renderContext);
|
||||
let footer;
|
||||
if (iife !== undefined) {
|
||||
startupSource.add(
|
||||
|
@ -1310,14 +1310,14 @@ class JavascriptModulesPlugin {
|
|||
`${RuntimeGlobals.interceptModuleExecution}.forEach(function(handler) { handler(execOptions); });`,
|
||||
"module = execOptions.module;",
|
||||
"execOptions.factory.call(module.exports, module, module.exports, execOptions.require);"
|
||||
])
|
||||
])
|
||||
: runtimeRequirements.has(RuntimeGlobals.thisAsExports)
|
||||
? Template.asString([
|
||||
`__webpack_modules__[moduleId].call(module.exports, module, module.exports, ${RuntimeGlobals.require});`
|
||||
])
|
||||
: Template.asString([
|
||||
`__webpack_modules__[moduleId](module, module.exports, ${RuntimeGlobals.require});`
|
||||
]);
|
||||
? Template.asString([
|
||||
`__webpack_modules__[moduleId].call(module.exports, module, module.exports, ${RuntimeGlobals.require});`
|
||||
])
|
||||
: Template.asString([
|
||||
`__webpack_modules__[moduleId](module, module.exports, ${RuntimeGlobals.require});`
|
||||
]);
|
||||
const needModuleId = runtimeRequirements.has(RuntimeGlobals.moduleId);
|
||||
const needModuleLoaded = runtimeRequirements.has(
|
||||
RuntimeGlobals.moduleLoaded
|
||||
|
@ -1330,7 +1330,7 @@ class JavascriptModulesPlugin {
|
|||
? Template.indent([
|
||||
"if (cachedModule.error !== undefined) throw cachedModule.error;",
|
||||
"return cachedModule.exports;"
|
||||
])
|
||||
])
|
||||
: Template.indent("return cachedModule.exports;"),
|
||||
"}",
|
||||
"// Create a new module (and put it into the cache)",
|
||||
|
@ -1353,27 +1353,27 @@ class JavascriptModulesPlugin {
|
|||
"if(threw) delete __webpack_module_cache__[moduleId];"
|
||||
]),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: outputOptions.strictModuleErrorHandling
|
||||
? Template.asString([
|
||||
"// Execute the module function",
|
||||
"try {",
|
||||
Template.indent(moduleExecution),
|
||||
"} catch(e) {",
|
||||
Template.indent(["module.error = e;", "throw e;"]),
|
||||
"}"
|
||||
])
|
||||
: Template.asString([
|
||||
"// Execute the module function",
|
||||
moduleExecution
|
||||
]),
|
||||
? Template.asString([
|
||||
"// Execute the module function",
|
||||
"try {",
|
||||
Template.indent(moduleExecution),
|
||||
"} catch(e) {",
|
||||
Template.indent(["module.error = e;", "throw e;"]),
|
||||
"}"
|
||||
])
|
||||
: Template.asString([
|
||||
"// Execute the module function",
|
||||
moduleExecution
|
||||
]),
|
||||
needModuleLoaded
|
||||
? Template.asString([
|
||||
"",
|
||||
"// Flag the module as loaded",
|
||||
`${RuntimeGlobals.moduleLoaded} = true;`,
|
||||
""
|
||||
])
|
||||
])
|
||||
: "",
|
||||
"// Return the exports of the module",
|
||||
"return module.exports;"
|
||||
|
|
|
@ -295,7 +295,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
|||
const exportAccess = options.export
|
||||
? propertyAccess(
|
||||
Array.isArray(options.export) ? options.export : [options.export]
|
||||
)
|
||||
)
|
||||
: "";
|
||||
const result = new ConcatSource(source);
|
||||
if (staticExports) {
|
||||
|
|
|
@ -187,7 +187,7 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin {
|
|||
.join(",\n")
|
||||
),
|
||||
"],"
|
||||
]);
|
||||
]);
|
||||
|
||||
return new ConcatSource(
|
||||
Template.asString([
|
||||
|
|
|
@ -243,8 +243,8 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
|||
const factoryArguments =
|
||||
requiredExternals.length > 0
|
||||
? externalsArguments(requiredExternals) +
|
||||
", " +
|
||||
externalsRootArray(optionalExternals)
|
||||
", " +
|
||||
externalsRootArray(optionalExternals)
|
||||
: externalsRootArray(optionalExternals);
|
||||
amdFactory =
|
||||
`function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` +
|
||||
|
@ -283,55 +283,55 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
|||
(requiredExternals.length > 0
|
||||
? names.amd && namedDefine === true
|
||||
? " define(" +
|
||||
libraryName(names.amd) +
|
||||
", " +
|
||||
externalsDepsArray(requiredExternals) +
|
||||
", " +
|
||||
amdFactory +
|
||||
");\n"
|
||||
libraryName(names.amd) +
|
||||
", " +
|
||||
externalsDepsArray(requiredExternals) +
|
||||
", " +
|
||||
amdFactory +
|
||||
");\n"
|
||||
: " define(" +
|
||||
externalsDepsArray(requiredExternals) +
|
||||
", " +
|
||||
amdFactory +
|
||||
");\n"
|
||||
externalsDepsArray(requiredExternals) +
|
||||
", " +
|
||||
amdFactory +
|
||||
");\n"
|
||||
: names.amd && namedDefine === true
|
||||
? " define(" +
|
||||
libraryName(names.amd) +
|
||||
", [], " +
|
||||
amdFactory +
|
||||
");\n"
|
||||
: " define([], " + amdFactory + ");\n") +
|
||||
? " define(" +
|
||||
libraryName(names.amd) +
|
||||
", [], " +
|
||||
amdFactory +
|
||||
");\n"
|
||||
: " define([], " + amdFactory + ");\n") +
|
||||
(names.root || names.commonjs
|
||||
? getAuxiliaryComment("commonjs") +
|
||||
" else if(typeof exports === 'object')\n" +
|
||||
" exports[" +
|
||||
libraryName(names.commonjs || names.root) +
|
||||
"] = factory(" +
|
||||
externalsRequireArray("commonjs") +
|
||||
");\n" +
|
||||
getAuxiliaryComment("root") +
|
||||
" else\n" +
|
||||
" " +
|
||||
replaceKeys(
|
||||
" else if(typeof exports === 'object')\n" +
|
||||
" exports[" +
|
||||
libraryName(names.commonjs || names.root) +
|
||||
"] = factory(" +
|
||||
externalsRequireArray("commonjs") +
|
||||
");\n" +
|
||||
getAuxiliaryComment("root") +
|
||||
" else\n" +
|
||||
" " +
|
||||
replaceKeys(
|
||||
accessorAccess(
|
||||
"root",
|
||||
/** @type {string | string[]} */ (names.root) ||
|
||||
/** @type {string} */ (names.commonjs)
|
||||
)
|
||||
) +
|
||||
" = factory(" +
|
||||
externalsRootArray(externals) +
|
||||
");\n"
|
||||
) +
|
||||
" = factory(" +
|
||||
externalsRootArray(externals) +
|
||||
");\n"
|
||||
: " else {\n" +
|
||||
(externals.length > 0
|
||||
(externals.length > 0
|
||||
? " var a = typeof exports === 'object' ? factory(" +
|
||||
externalsRequireArray("commonjs") +
|
||||
") : factory(" +
|
||||
externalsRootArray(externals) +
|
||||
");\n"
|
||||
externalsRequireArray("commonjs") +
|
||||
") : factory(" +
|
||||
externalsRootArray(externals) +
|
||||
");\n"
|
||||
: " var a = factory();\n") +
|
||||
" for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" +
|
||||
" }\n") +
|
||||
" for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" +
|
||||
" }\n") +
|
||||
`})(${runtimeTemplate.outputOptions.globalObject}, ${
|
||||
runtimeTemplate.supportsArrowFunction()
|
||||
? `(${externalsArguments(externals)}) =>`
|
||||
|
|
|
@ -113,10 +113,10 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
withOnChunkLoad
|
||||
? `${
|
||||
RuntimeGlobals.onChunksLoaded
|
||||
}.readFileVm = ${runtimeTemplate.returningFunction(
|
||||
}.readFileVm = ${runtimeTemplate.returningFunction(
|
||||
"installedChunks[chunkId] === 0",
|
||||
"chunkId"
|
||||
)};`
|
||||
)};`
|
||||
: "// no on chunks loaded",
|
||||
"",
|
||||
withLoading || withExternalInstallChunk
|
||||
|
@ -141,7 +141,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
]),
|
||||
"}",
|
||||
withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : ""
|
||||
])};`
|
||||
])};`
|
||||
: "// no chunk install function needed",
|
||||
"",
|
||||
withLoading
|
||||
|
@ -192,17 +192,17 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"}"
|
||||
]),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: Template.indent(["installedChunks[chunkId] = 0;"]),
|
||||
"};"
|
||||
])
|
||||
])
|
||||
: "// no chunk loading",
|
||||
"",
|
||||
withExternalInstallChunk
|
||||
? Template.asString([
|
||||
`module.exports = ${RuntimeGlobals.require};`,
|
||||
`${RuntimeGlobals.externalInstallChunk} = installChunk;`
|
||||
])
|
||||
])
|
||||
: "// no external install chunk",
|
||||
"",
|
||||
withHmr
|
||||
|
@ -263,7 +263,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
/\$hmrInvalidateModuleHandlers\$/g,
|
||||
RuntimeGlobals.hmrInvalidateModuleHandlers
|
||||
)
|
||||
])
|
||||
])
|
||||
: "// no HMR",
|
||||
"",
|
||||
withHmrManifest
|
||||
|
@ -291,7 +291,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"});"
|
||||
]),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: "// no HMR manifest"
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -113,10 +113,10 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
withOnChunkLoad
|
||||
? `${
|
||||
RuntimeGlobals.onChunksLoaded
|
||||
}.require = ${runtimeTemplate.returningFunction(
|
||||
}.require = ${runtimeTemplate.returningFunction(
|
||||
"installedChunks[chunkId]",
|
||||
"chunkId"
|
||||
)};`
|
||||
)};`
|
||||
: "// no on chunks loaded",
|
||||
"",
|
||||
withLoading || withExternalInstallChunk
|
||||
|
@ -135,7 +135,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"for(var i = 0; i < chunkIds.length; i++)",
|
||||
Template.indent("installedChunks[chunkIds[i]] = 1;"),
|
||||
withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : ""
|
||||
])};`
|
||||
])};`
|
||||
: "// no chunk install function needed",
|
||||
"",
|
||||
withLoading
|
||||
|
@ -162,17 +162,17 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
""
|
||||
]),
|
||||
"}"
|
||||
]
|
||||
]
|
||||
: "installedChunks[chunkId] = 1;"
|
||||
)};`
|
||||
])
|
||||
])
|
||||
: "// no chunk loading",
|
||||
"",
|
||||
withExternalInstallChunk
|
||||
? Template.asString([
|
||||
`module.exports = ${RuntimeGlobals.require};`,
|
||||
`${RuntimeGlobals.externalInstallChunk} = installChunk;`
|
||||
])
|
||||
])
|
||||
: "// no external install chunk",
|
||||
"",
|
||||
withHmr
|
||||
|
@ -220,7 +220,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
/\$hmrInvalidateModuleHandlers\$/g,
|
||||
RuntimeGlobals.hmrInvalidateModuleHandlers
|
||||
)
|
||||
])
|
||||
])
|
||||
: "// no HMR",
|
||||
"",
|
||||
withHmrManifest
|
||||
|
@ -236,7 +236,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });"
|
||||
]),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: "// no HMR manifest"
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -132,6 +132,6 @@ module.exports = ({ colors, appendOnly, stream }) => {
|
|||
currentStatusMessage = [name, ...args];
|
||||
writeStatusMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -335,10 +335,10 @@ const getFinalBinding = (
|
|||
const defaultExport = asCall
|
||||
? `${info.interopDefaultAccessName}()`
|
||||
: asiSafe
|
||||
? `(${info.interopDefaultAccessName}())`
|
||||
: asiSafe === false
|
||||
? `;(${info.interopDefaultAccessName}())`
|
||||
: `${info.interopDefaultAccessName}.a`;
|
||||
? `(${info.interopDefaultAccessName}())`
|
||||
: asiSafe === false
|
||||
? `;(${info.interopDefaultAccessName}())`
|
||||
: `${info.interopDefaultAccessName}.a`;
|
||||
return {
|
||||
info,
|
||||
rawName: defaultExport,
|
||||
|
@ -568,8 +568,8 @@ const getFinalName = (
|
|||
return asiSafe
|
||||
? `(0,${reference})`
|
||||
: asiSafe === false
|
||||
? `;(0,${reference})`
|
||||
: `/*#__PURE__*/Object(${reference})`;
|
||||
? `;(0,${reference})`
|
||||
: `/*#__PURE__*/Object(${reference})`;
|
||||
}
|
||||
return reference;
|
||||
}
|
||||
|
@ -1541,7 +1541,7 @@ class ConcatenatedModule extends Module {
|
|||
nsObj.length > 0
|
||||
? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join(
|
||||
","
|
||||
)}\n});\n`
|
||||
)}\n});\n`
|
||||
: "";
|
||||
if (nsObj.length > 0)
|
||||
runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
|
||||
|
|
|
@ -284,8 +284,8 @@ class ModuleConcatenationPlugin {
|
|||
filteredRuntime === true
|
||||
? chunkRuntime
|
||||
: filteredRuntime === false
|
||||
? undefined
|
||||
: filteredRuntime;
|
||||
? undefined
|
||||
: filteredRuntime;
|
||||
|
||||
// create a configuration with the root
|
||||
const currentConfiguration = new ConcatConfiguration(
|
||||
|
|
|
@ -159,8 +159,8 @@ class SideEffectsFlagPlugin {
|
|||
statement.test
|
||||
? statement.test.range[1]
|
||||
: statement.init
|
||||
? statement.init.range[1]
|
||||
: statement.range[0]
|
||||
? statement.init.range[1]
|
||||
: statement.range[0]
|
||||
)
|
||||
) {
|
||||
sideEffectsStatement = statement;
|
||||
|
|
|
@ -749,20 +749,20 @@ module.exports = class SplitChunksPlugin {
|
|||
cacheGroupSource.minChunks !== undefined
|
||||
? cacheGroupSource.minChunks
|
||||
: cacheGroupSource.enforce
|
||||
? 1
|
||||
: this.options.minChunks,
|
||||
? 1
|
||||
: this.options.minChunks,
|
||||
maxAsyncRequests:
|
||||
cacheGroupSource.maxAsyncRequests !== undefined
|
||||
? cacheGroupSource.maxAsyncRequests
|
||||
: cacheGroupSource.enforce
|
||||
? Infinity
|
||||
: this.options.maxAsyncRequests,
|
||||
? Infinity
|
||||
: this.options.maxAsyncRequests,
|
||||
maxInitialRequests:
|
||||
cacheGroupSource.maxInitialRequests !== undefined
|
||||
? cacheGroupSource.maxInitialRequests
|
||||
: cacheGroupSource.enforce
|
||||
? Infinity
|
||||
: this.options.maxInitialRequests,
|
||||
? Infinity
|
||||
: this.options.maxInitialRequests,
|
||||
getName:
|
||||
cacheGroupSource.getName !== undefined
|
||||
? cacheGroupSource.getName
|
||||
|
@ -1428,13 +1428,13 @@ module.exports = class SplitChunksPlugin {
|
|||
chunk.isOnlyInitial()
|
||||
? item.cacheGroup.maxInitialRequests
|
||||
: chunk.canBeInitial()
|
||||
? Math.min(
|
||||
/** @type {number} */
|
||||
(item.cacheGroup.maxInitialRequests),
|
||||
/** @type {number} */
|
||||
(item.cacheGroup.maxAsyncRequests)
|
||||
)
|
||||
: item.cacheGroup.maxAsyncRequests
|
||||
? Math.min(
|
||||
/** @type {number} */
|
||||
(item.cacheGroup.maxInitialRequests),
|
||||
/** @type {number} */
|
||||
(item.cacheGroup.maxAsyncRequests)
|
||||
)
|
||||
: item.cacheGroup.maxAsyncRequests
|
||||
);
|
||||
if (
|
||||
isFinite(maxRequests) &&
|
||||
|
@ -1569,21 +1569,21 @@ module.exports = class SplitChunksPlugin {
|
|||
oldMaxSizeSettings.minSize,
|
||||
item.cacheGroup._minSizeForMaxSize,
|
||||
Math.max
|
||||
)
|
||||
)
|
||||
: item.cacheGroup.minSize,
|
||||
maxAsyncSize: oldMaxSizeSettings
|
||||
? combineSizes(
|
||||
oldMaxSizeSettings.maxAsyncSize,
|
||||
item.cacheGroup.maxAsyncSize,
|
||||
Math.min
|
||||
)
|
||||
)
|
||||
: item.cacheGroup.maxAsyncSize,
|
||||
maxInitialSize: oldMaxSizeSettings
|
||||
? combineSizes(
|
||||
oldMaxSizeSettings.maxInitialSize,
|
||||
item.cacheGroup.maxInitialSize,
|
||||
Math.min
|
||||
)
|
||||
)
|
||||
: item.cacheGroup.maxInitialSize,
|
||||
automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter,
|
||||
keys: oldMaxSizeSettings
|
||||
|
|
|
@ -42,10 +42,10 @@ class ChunkPrefetchStartupRuntimeModule extends RuntimeModule {
|
|||
chunks,
|
||||
c =>
|
||||
`${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});`
|
||||
)
|
||||
)
|
||||
: `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${
|
||||
RuntimeGlobals.prefetchChunk
|
||||
});`
|
||||
});`
|
||||
)}, 5);`
|
||||
)
|
||||
);
|
||||
|
|
|
@ -63,7 +63,7 @@ class AutoPublicPathRuntimeModule extends RuntimeModule {
|
|||
"}"
|
||||
]),
|
||||
"}"
|
||||
]),
|
||||
]),
|
||||
"// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration",
|
||||
'// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.',
|
||||
'if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");',
|
||||
|
@ -72,7 +72,7 @@ class AutoPublicPathRuntimeModule extends RuntimeModule {
|
|||
? `${RuntimeGlobals.publicPath} = scriptUrl;`
|
||||
: `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify(
|
||||
undoPath
|
||||
)};`
|
||||
)};`
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule {
|
|||
chunk: c,
|
||||
contentHashType: contentType
|
||||
})
|
||||
)
|
||||
)
|
||||
: JSON.stringify(chunkFilename);
|
||||
const staticChunkFilename = compilation.getPath(chunkFilenameValue, {
|
||||
hash: `" + ${RuntimeGlobals.getFullHash}() + "`,
|
||||
|
@ -219,7 +219,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule {
|
|||
return useId
|
||||
? `(chunkId === ${JSON.stringify(lastKey)} ? ${JSON.stringify(
|
||||
obj[/** @type {number | string} */ (lastKey)]
|
||||
)} : chunkId)`
|
||||
)} : chunkId)`
|
||||
: JSON.stringify(obj[/** @type {number | string} */ (lastKey)]);
|
||||
}
|
||||
return useId
|
||||
|
@ -285,13 +285,13 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule {
|
|||
: `{${Array.from(
|
||||
ids,
|
||||
id => `${JSON.stringify(id)}:1`
|
||||
).join(",")}}[chunkId]`;
|
||||
).join(",")}}[chunkId]`;
|
||||
return `if (${condition}) return ${url};`;
|
||||
})
|
||||
),
|
||||
"// return url for filenames based on template",
|
||||
`return ${url};`
|
||||
]
|
||||
]
|
||||
: ["// return url for filenames based on template", `return ${url};`]
|
||||
)};`
|
||||
]);
|
||||
|
|
|
@ -46,7 +46,7 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule {
|
|||
"script",
|
||||
"script"
|
||||
)}`
|
||||
]
|
||||
]
|
||||
: []),
|
||||
...(this.runtimeRequirements.has(RuntimeGlobals.createScriptUrl)
|
||||
? [
|
||||
|
@ -54,7 +54,7 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule {
|
|||
"url",
|
||||
"url"
|
||||
)}`
|
||||
]
|
||||
]
|
||||
: [])
|
||||
].join(",\n")
|
||||
),
|
||||
|
@ -80,11 +80,11 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule {
|
|||
)}');`
|
||||
]),
|
||||
"}"
|
||||
]
|
||||
]
|
||||
: [])
|
||||
]),
|
||||
"}"
|
||||
]
|
||||
]
|
||||
: [])
|
||||
]),
|
||||
"}",
|
||||
|
|
|
@ -90,7 +90,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
|
|||
'script.setAttribute("fetchpriority", fetchPriority);'
|
||||
),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: "",
|
||||
`script.src = ${
|
||||
this._withCreateScriptUrl
|
||||
|
@ -106,7 +106,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
|
|||
`script.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
|
||||
),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: ""
|
||||
]);
|
||||
|
||||
|
|
|
@ -46,28 +46,29 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule {
|
|||
)
|
||||
.concat("return next();")
|
||||
: chunkIds.length === 1
|
||||
? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify(
|
||||
chunkIds[0]
|
||||
)}).then(next);`
|
||||
: chunkIds.length > 2
|
||||
? [
|
||||
// using map is shorter for 3 or more chunks
|
||||
`return Promise.all(${JSON.stringify(chunkIds)}.map(${
|
||||
RuntimeGlobals.ensureChunk
|
||||
}, ${RuntimeGlobals.require})).then(next);`
|
||||
]
|
||||
: [
|
||||
// calling ensureChunk directly is shorter for 0 - 2 chunks
|
||||
"return Promise.all([",
|
||||
Template.indent(
|
||||
chunkIds
|
||||
.map(
|
||||
id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})`
|
||||
)
|
||||
.join(",\n")
|
||||
),
|
||||
"]).then(next);"
|
||||
]
|
||||
? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify(
|
||||
chunkIds[0]
|
||||
)}).then(next);`
|
||||
: chunkIds.length > 2
|
||||
? [
|
||||
// using map is shorter for 3 or more chunks
|
||||
`return Promise.all(${JSON.stringify(chunkIds)}.map(${
|
||||
RuntimeGlobals.ensureChunk
|
||||
}, ${RuntimeGlobals.require})).then(next);`
|
||||
]
|
||||
: [
|
||||
// calling ensureChunk directly is shorter for 0 - 2 chunks
|
||||
"return Promise.all([",
|
||||
Template.indent(
|
||||
chunkIds
|
||||
.map(
|
||||
id =>
|
||||
`${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})`
|
||||
)
|
||||
.join(",\n")
|
||||
),
|
||||
"]).then(next);"
|
||||
]
|
||||
)};`
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ class StartupEntrypointRuntimeModule extends RuntimeModule {
|
|||
"var r = fn();",
|
||||
"return r === undefined ? result : r;"
|
||||
])})`
|
||||
]
|
||||
]
|
||||
: [
|
||||
`chunkIds.map(${RuntimeGlobals.ensureChunk}, ${RuntimeGlobals.require})`,
|
||||
"var r = fn();",
|
||||
"return r === undefined ? result : r;"
|
||||
])
|
||||
])
|
||||
])}`;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ class Lockfile {
|
|||
: {
|
||||
resolved: key,
|
||||
...entry
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
return lockfile;
|
||||
|
|
|
@ -60,23 +60,23 @@ const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024;
|
|||
const writeUInt64LE = Buffer.prototype.writeBigUInt64LE
|
||||
? (buf, value, offset) => {
|
||||
buf.writeBigUInt64LE(BigInt(value), offset);
|
||||
}
|
||||
}
|
||||
: (buf, value, offset) => {
|
||||
const low = value % 0x100000000;
|
||||
const high = (value - low) / 0x100000000;
|
||||
buf.writeUInt32LE(low, offset);
|
||||
buf.writeUInt32LE(high, offset + 4);
|
||||
};
|
||||
};
|
||||
|
||||
const readUInt64LE = Buffer.prototype.readBigUInt64LE
|
||||
? (buf, offset) => {
|
||||
return Number(buf.readBigUInt64LE(offset));
|
||||
}
|
||||
}
|
||||
: (buf, offset) => {
|
||||
const low = buf.readUInt32LE(offset);
|
||||
const high = buf.readUInt32LE(offset + 4);
|
||||
return high * 0x100000000 + low;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} SerializeResult
|
||||
|
|
|
@ -718,10 +718,10 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|||
const name = !serializerEntry
|
||||
? "unknown"
|
||||
: !serializerEntry[1].request
|
||||
? serializerEntry[0].name
|
||||
: serializerEntry[1].name
|
||||
? `${serializerEntry[1].request} ${serializerEntry[1].name}`
|
||||
: serializerEntry[1].request;
|
||||
? serializerEntry[0].name
|
||||
: serializerEntry[1].name
|
||||
? `${serializerEntry[1].request} ${serializerEntry[1].name}`
|
||||
: serializerEntry[1].request;
|
||||
err.message += `\n(during deserialization of ${name})`;
|
||||
throw err;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class ConsumeSharedPlugin {
|
|||
let result =
|
||||
item === key || !isRequiredVersion(item)
|
||||
? // item is a request/key
|
||||
{
|
||||
{
|
||||
import: key,
|
||||
shareScope: options.shareScope || "default",
|
||||
shareKey: key,
|
||||
|
@ -69,10 +69,10 @@ class ConsumeSharedPlugin {
|
|||
strictVersion: false,
|
||||
singleton: false,
|
||||
eager: false
|
||||
}
|
||||
}
|
||||
: // key is a request/key
|
||||
// item is a version
|
||||
{
|
||||
// item is a version
|
||||
{
|
||||
import: key,
|
||||
shareScope: options.shareScope || "default",
|
||||
shareKey: key,
|
||||
|
@ -81,7 +81,7 @@ class ConsumeSharedPlugin {
|
|||
packageName: undefined,
|
||||
singleton: false,
|
||||
eager: false
|
||||
};
|
||||
};
|
||||
return result;
|
||||
},
|
||||
(item, key) => ({
|
||||
|
|
|
@ -179,7 +179,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|||
? runtimeTemplate.basicFunction("", "")
|
||||
: runtimeTemplate.basicFunction("msg", [
|
||||
'if (typeof console !== "undefined" && console.warn) console.warn(msg);'
|
||||
])
|
||||
])
|
||||
};`,
|
||||
`var warnInvalidVersion = ${runtimeTemplate.basicFunction(
|
||||
"scope, scopeName, key, requiredVersion",
|
||||
|
@ -312,7 +312,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|||
`module.exports = factory();`
|
||||
])}`
|
||||
])});`
|
||||
])
|
||||
])
|
||||
: "// no consumes in initial chunks",
|
||||
this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)
|
||||
? Template.asString([
|
||||
|
@ -370,7 +370,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|||
]),
|
||||
"}"
|
||||
])}`
|
||||
])
|
||||
])
|
||||
: "// no chunk loading of consumes"
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -141,13 +141,13 @@ class ProvideSharedModule extends Module {
|
|||
chunkGraph,
|
||||
request: this._request,
|
||||
runtimeRequirements
|
||||
})
|
||||
})
|
||||
: runtimeTemplate.asyncModuleFactory({
|
||||
block: this.blocks[0],
|
||||
chunkGraph,
|
||||
request: this._request,
|
||||
runtimeRequirements
|
||||
})
|
||||
})
|
||||
}${this._eager ? ", 1" : ""});`;
|
||||
const sources = new Map();
|
||||
const data = new Map();
|
||||
|
|
|
@ -34,11 +34,11 @@ class SharePlugin {
|
|||
item === key || !isRequiredVersion(item)
|
||||
? {
|
||||
import: item
|
||||
}
|
||||
}
|
||||
: {
|
||||
import: key,
|
||||
requiredVersion: item
|
||||
};
|
||||
};
|
||||
return config;
|
||||
},
|
||||
item => item
|
||||
|
|
|
@ -89,7 +89,7 @@ class ShareRuntimeModule extends RuntimeModule {
|
|||
? runtimeTemplate.basicFunction("", "")
|
||||
: runtimeTemplate.basicFunction("msg", [
|
||||
'if (typeof console !== "undefined" && console.warn) console.warn(msg);'
|
||||
])
|
||||
])
|
||||
};`,
|
||||
`var uniqueName = ${JSON.stringify(uniqueName || undefined)};`,
|
||||
`var register = ${runtimeTemplate.basicFunction(
|
||||
|
|
|
@ -1068,7 +1068,7 @@ const SIMPLE_EXTRACTORS = {
|
|||
|
||||
return childStatsChunkGroup;
|
||||
})
|
||||
)
|
||||
)
|
||||
: undefined,
|
||||
childAssets: children
|
||||
? mapObject(children, groups => {
|
||||
|
@ -1082,7 +1082,7 @@ const SIMPLE_EXTRACTORS = {
|
|||
}
|
||||
}
|
||||
return Array.from(set);
|
||||
})
|
||||
})
|
||||
: undefined
|
||||
};
|
||||
Object.assign(object, statsChunkGroup);
|
||||
|
@ -1379,8 +1379,8 @@ const SIMPLE_EXTRACTORS = {
|
|||
chunk.runtime === undefined
|
||||
? undefined
|
||||
: typeof chunk.runtime === "string"
|
||||
? [makePathsRelative(chunk.runtime)]
|
||||
: Array.from(chunk.runtime.sort(), makePathsRelative),
|
||||
? [makePathsRelative(chunk.runtime)]
|
||||
: Array.from(chunk.runtime.sort(), makePathsRelative),
|
||||
files: Array.from(chunk.files),
|
||||
auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds),
|
||||
hash: chunk.renderedHash,
|
||||
|
@ -1633,8 +1633,8 @@ const getItemSize = item => {
|
|||
return !item.children
|
||||
? 1
|
||||
: item.filteredChildren
|
||||
? 2 + getTotalSize(item.children)
|
||||
: 1 + getTotalSize(item.children);
|
||||
? 2 + getTotalSize(item.children)
|
||||
: 1 + getTotalSize(item.children);
|
||||
};
|
||||
|
||||
const getTotalSize = children => {
|
||||
|
@ -1912,13 +1912,13 @@ const ASSETS_GROUPERS = {
|
|||
[name]: !!key,
|
||||
filteredChildren: assets.length,
|
||||
...assetGroup(children, assets)
|
||||
}
|
||||
}
|
||||
: {
|
||||
type: "assets by status",
|
||||
[name]: !!key,
|
||||
children,
|
||||
...assetGroup(children, assets)
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -2169,8 +2169,8 @@ const MODULES_GROUPERS = type => ({
|
|||
type: isDataUrl
|
||||
? "modules by mime type"
|
||||
: groupModulesByPath
|
||||
? "modules by path"
|
||||
: "modules by extension",
|
||||
? "modules by path"
|
||||
: "modules by extension",
|
||||
name: isDataUrl ? key.slice(/* 'data:'.length */ 5) : key,
|
||||
children,
|
||||
...moduleGroup(children, modules)
|
||||
|
|
|
@ -197,8 +197,8 @@ const DEFAULTS = {
|
|||
runtime !== undefined
|
||||
? runtime
|
||||
: forToString
|
||||
? all === true
|
||||
: all !== false,
|
||||
? all === true
|
||||
: all !== false,
|
||||
cachedModules: ({ all, cached }, { forToString }) =>
|
||||
cached !== undefined ? cached : forToString ? all === true : all !== false,
|
||||
moduleAssets: OFF_FOR_TO_STRING,
|
||||
|
|
|
@ -128,7 +128,7 @@ const SIMPLE_PRINTERS = {
|
|||
warningsCount > 0
|
||||
? yellow(
|
||||
`${warningsCount} ${plural(warningsCount, "warning", "warnings")}`
|
||||
)
|
||||
)
|
||||
: "";
|
||||
const errorsMessage =
|
||||
errorsCount > 0
|
||||
|
@ -143,10 +143,10 @@ const SIMPLE_PRINTERS = {
|
|||
root && name
|
||||
? bold(name)
|
||||
: name
|
||||
? `Child ${bold(name)}`
|
||||
: root
|
||||
? ""
|
||||
: "Child";
|
||||
? `Child ${bold(name)}`
|
||||
: root
|
||||
? ""
|
||||
: "Child";
|
||||
const subjectMessage =
|
||||
nameMessage && versionMessage
|
||||
? `${nameMessage} (${versionMessage})`
|
||||
|
@ -180,7 +180,7 @@ const SIMPLE_PRINTERS = {
|
|||
count,
|
||||
"warning has",
|
||||
"warnings have"
|
||||
)} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`
|
||||
)} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`
|
||||
: undefined,
|
||||
"compilation.filteredErrorDetailsCount": (count, { yellow }) =>
|
||||
count
|
||||
|
@ -190,7 +190,7 @@ const SIMPLE_PRINTERS = {
|
|||
"error has",
|
||||
"errors have"
|
||||
)} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`
|
||||
)
|
||||
)
|
||||
: undefined,
|
||||
"compilation.env": (env, { bold }) =>
|
||||
env
|
||||
|
@ -204,7 +204,7 @@ const SIMPLE_PRINTERS = {
|
|||
: printer.print(context.type, Object.values(entrypoints), {
|
||||
...context,
|
||||
chunkGroupKind: "Entrypoint"
|
||||
}),
|
||||
}),
|
||||
"compilation.namedChunkGroups": (namedChunkGroups, context, printer) => {
|
||||
if (!Array.isArray(namedChunkGroups)) {
|
||||
const {
|
||||
|
@ -234,15 +234,18 @@ const SIMPLE_PRINTERS = {
|
|||
filteredModules,
|
||||
"module",
|
||||
"modules"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) =>
|
||||
"compilation.filteredAssets": (
|
||||
filteredAssets,
|
||||
{ compilation: { assets } }
|
||||
) =>
|
||||
filteredAssets > 0
|
||||
? `${moreCount(assets, filteredAssets)} ${plural(
|
||||
filteredAssets,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"compilation.logging": (logging, context, printer) =>
|
||||
Array.isArray(logging)
|
||||
|
@ -251,7 +254,7 @@ const SIMPLE_PRINTERS = {
|
|||
context.type,
|
||||
Object.entries(logging).map(([name, value]) => ({ ...value, name })),
|
||||
context
|
||||
),
|
||||
),
|
||||
"compilation.warningsInChildren!": (_, { yellow, compilation }) => {
|
||||
if (
|
||||
!compilation.children &&
|
||||
|
@ -324,7 +327,7 @@ const SIMPLE_PRINTERS = {
|
|||
sourceFilename === true
|
||||
? "from source file"
|
||||
: `from: ${sourceFilename}`
|
||||
)
|
||||
)
|
||||
: undefined,
|
||||
"asset.info.development": (development, { green, formatFlag }) =>
|
||||
development ? green(formatFlag("dev")) : undefined,
|
||||
|
@ -339,7 +342,7 @@ const SIMPLE_PRINTERS = {
|
|||
filteredRelated,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"asset.filteredChildren": (filteredChildren, { asset: { children } }) =>
|
||||
filteredChildren > 0
|
||||
|
@ -347,7 +350,7 @@ const SIMPLE_PRINTERS = {
|
|||
filteredChildren,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
|
||||
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
||||
|
@ -393,22 +396,22 @@ const SIMPLE_PRINTERS = {
|
|||
formatFlag(
|
||||
`${assets.length} ${plural(assets.length, "asset", "assets")}`
|
||||
)
|
||||
)
|
||||
)
|
||||
: undefined,
|
||||
"module.warnings": (warnings, { formatFlag, yellow }) =>
|
||||
warnings === true
|
||||
? yellow(formatFlag("warnings"))
|
||||
: warnings
|
||||
? yellow(
|
||||
formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`)
|
||||
)
|
||||
: undefined,
|
||||
? yellow(
|
||||
formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`)
|
||||
)
|
||||
: undefined,
|
||||
"module.errors": (errors, { formatFlag, red }) =>
|
||||
errors === true
|
||||
? red(formatFlag("errors"))
|
||||
: errors
|
||||
? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`))
|
||||
: undefined,
|
||||
? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`))
|
||||
: undefined,
|
||||
"module.providedExports": (providedExports, { formatFlag, cyan }) => {
|
||||
if (Array.isArray(providedExports)) {
|
||||
if (providedExports.length === 0) return cyan(formatFlag("no exports"));
|
||||
|
@ -449,7 +452,7 @@ const SIMPLE_PRINTERS = {
|
|||
filteredModules,
|
||||
"module",
|
||||
"modules"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"module.filteredReasons": (filteredReasons, { module: { reasons } }) =>
|
||||
filteredReasons > 0
|
||||
|
@ -457,7 +460,7 @@ const SIMPLE_PRINTERS = {
|
|||
filteredReasons,
|
||||
"reason",
|
||||
"reasons"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"module.filteredChildren": (filteredChildren, { module: { children } }) =>
|
||||
filteredChildren > 0
|
||||
|
@ -465,7 +468,7 @@ const SIMPLE_PRINTERS = {
|
|||
filteredChildren,
|
||||
"module",
|
||||
"modules"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"module.separator!": () => "\n",
|
||||
|
||||
|
@ -492,7 +495,7 @@ const SIMPLE_PRINTERS = {
|
|||
filteredChildren,
|
||||
"reason",
|
||||
"reasons"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
|
||||
"module.profile.total": (value, { formatTime }) => formatTime(value),
|
||||
|
@ -533,7 +536,7 @@ const SIMPLE_PRINTERS = {
|
|||
n,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"chunkGroup.is!": () => "=",
|
||||
"chunkGroupAsset.name": (asset, { green }) => green(asset),
|
||||
|
@ -552,7 +555,7 @@ const SIMPLE_PRINTERS = {
|
|||
children: children[key]
|
||||
})),
|
||||
context
|
||||
),
|
||||
),
|
||||
"chunkGroupChildGroup.type": type => `${type}:`,
|
||||
"chunkGroupChild.assets[]": (file, { formatFilename }) =>
|
||||
formatFilename(file),
|
||||
|
@ -581,7 +584,7 @@ const SIMPLE_PRINTERS = {
|
|||
children: childrenByOrder[key]
|
||||
})),
|
||||
context
|
||||
),
|
||||
),
|
||||
"chunk.childrenByOrder[].type": type => `${type}:`,
|
||||
"chunk.childrenByOrder[].children[]": (id, { formatChunkId }) =>
|
||||
isValidId(id) ? formatChunkId(id) : undefined,
|
||||
|
@ -600,7 +603,7 @@ const SIMPLE_PRINTERS = {
|
|||
filteredModules,
|
||||
"module",
|
||||
"modules"
|
||||
)}`
|
||||
)}`
|
||||
: undefined,
|
||||
"chunk.separator!": () => "\n",
|
||||
|
||||
|
@ -1354,7 +1357,7 @@ class DefaultStatsPrinterPlugin {
|
|||
? str.replace(
|
||||
/((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g,
|
||||
`$1${start}`
|
||||
)
|
||||
)
|
||||
: str
|
||||
}\u001b[39m\u001b[22m`;
|
||||
} else {
|
||||
|
|
|
@ -457,8 +457,8 @@ const mergeSingleValue = (a, b, internalCaching) => {
|
|||
return aType !== VALUE_TYPE_OBJECT
|
||||
? b
|
||||
: internalCaching
|
||||
? cachedCleverMerge(a, b)
|
||||
: cleverMerge(a, b);
|
||||
? cachedCleverMerge(a, b)
|
||||
: cleverMerge(a, b);
|
||||
}
|
||||
case VALUE_TYPE_UNDEFINED:
|
||||
return a;
|
||||
|
@ -467,8 +467,8 @@ const mergeSingleValue = (a, b, internalCaching) => {
|
|||
aType !== VALUE_TYPE_ATOM
|
||||
? aType
|
||||
: Array.isArray(a)
|
||||
? VALUE_TYPE_ARRAY_EXTEND
|
||||
: VALUE_TYPE_OBJECT
|
||||
? VALUE_TYPE_ARRAY_EXTEND
|
||||
: VALUE_TYPE_OBJECT
|
||||
) {
|
||||
case VALUE_TYPE_UNDEFINED:
|
||||
return b;
|
||||
|
|
|
@ -376,6 +376,6 @@ exports.getUndoPath = (filename, outputPath, enforceRelative) => {
|
|||
return depth > 0
|
||||
? `${"../".repeat(depth)}${append}`
|
||||
: enforceRelative
|
||||
? `./${append}`
|
||||
: append;
|
||||
? `./${append}`
|
||||
: append;
|
||||
};
|
||||
|
|
|
@ -232,14 +232,14 @@ const rangeToString = range => {
|
|||
fixCount == 0
|
||||
? ">="
|
||||
: fixCount == -1
|
||||
? "<"
|
||||
: fixCount == 1
|
||||
? "^"
|
||||
: fixCount == 2
|
||||
? "~"
|
||||
: fixCount > 0
|
||||
? "="
|
||||
: "!=";
|
||||
? "<"
|
||||
: fixCount == 1
|
||||
? "^"
|
||||
: fixCount == 2
|
||||
? "~"
|
||||
: fixCount > 0
|
||||
? "="
|
||||
: "!=";
|
||||
var needDot = 1;
|
||||
for (var i = 1; i < range.length; i++) {
|
||||
var item = range[i];
|
||||
|
@ -248,9 +248,9 @@ const rangeToString = range => {
|
|||
str +=
|
||||
t == "u"
|
||||
? // undefined: prerelease marker, add an "-"
|
||||
"-"
|
||||
"-"
|
||||
: // number or string: add the item, set flag to add an "." between two of them
|
||||
(needDot > 0 ? "." : "") + ((needDot = 2), item);
|
||||
(needDot > 0 ? "." : "") + ((needDot = 2), item);
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
|
@ -263,10 +263,10 @@ const rangeToString = range => {
|
|||
item === 0
|
||||
? "not(" + pop() + ")"
|
||||
: item === 1
|
||||
? "(" + pop() + " || " + pop() + ")"
|
||||
: item === 2
|
||||
? stack.pop() + " " + stack.pop()
|
||||
: rangeToString(item)
|
||||
? "(" + pop() + " || " + pop() + ")"
|
||||
: item === 2
|
||||
? stack.pop() + " " + stack.pop()
|
||||
: rangeToString(item)
|
||||
);
|
||||
}
|
||||
return pop();
|
||||
|
@ -415,10 +415,10 @@ const satisfy = (range, version) => {
|
|||
item == 1
|
||||
? p() | p()
|
||||
: item == 2
|
||||
? p() & p()
|
||||
: item
|
||||
? satisfy(item, version)
|
||||
: !p()
|
||||
? p() & p()
|
||||
: item
|
||||
? satisfy(item, version)
|
||||
: !p()
|
||||
);
|
||||
}
|
||||
return !!p();
|
||||
|
@ -451,11 +451,7 @@ exports.stringifyHoley = json => {
|
|||
exports.parseVersionRuntimeCode = runtimeTemplate =>
|
||||
`var parseVersion = ${runtimeTemplate.basicFunction("str", [
|
||||
"// see webpack/lib/util/semver.js for original code",
|
||||
`var p=${
|
||||
runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"
|
||||
}{return p.split(".").map((${
|
||||
runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"
|
||||
}{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;`
|
||||
`var p=${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return p.split(".").map((${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;`
|
||||
])}`;
|
||||
//#endregion
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ const smartGrouping = (items, groupConfigs) => {
|
|||
(totalSize * 2) / targetGroupCount +
|
||||
itemsWithGroups.size -
|
||||
items.size
|
||||
);
|
||||
);
|
||||
if (
|
||||
sizeValue > bestGroupSize ||
|
||||
(force && (!bestGroupOptions || !bestGroupOptions.force))
|
||||
|
|
|
@ -69,7 +69,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule {
|
|||
])
|
||||
]),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: "// no support for streaming compilation",
|
||||
"return req",
|
||||
Template.indent([
|
||||
|
|
|
@ -156,7 +156,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator {
|
|||
"{",
|
||||
Template.indent(importObjRequestItems.join(",\n")),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: undefined;
|
||||
|
||||
const instantiateCall =
|
||||
|
@ -194,7 +194,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator {
|
|||
"} catch(e) { __webpack_async_result__(e); }"
|
||||
]
|
||||
)}, 1);`
|
||||
])
|
||||
])
|
||||
: `${importsCode}${importsCompatCode}module.exports = ${instantiateCall};`
|
||||
);
|
||||
|
||||
|
|
|
@ -354,7 +354,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"importObject"
|
||||
)});`
|
||||
])
|
||||
])
|
||||
])
|
||||
: Template.asString([
|
||||
"if(importObject && typeof importObject.then === 'function') {",
|
||||
Template.indent([
|
||||
|
@ -372,7 +372,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
]),
|
||||
"});"
|
||||
])
|
||||
]),
|
||||
]),
|
||||
"} else {",
|
||||
Template.indent([
|
||||
"var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });",
|
||||
|
|
|
@ -200,8 +200,8 @@ class WebAssemblyJavascriptGenerator extends Generator {
|
|||
copyAllExports
|
||||
? `${module.moduleArgument}.exports = wasmExports;`
|
||||
: "for(var name in wasmExports) " +
|
||||
`if(name) ` +
|
||||
`${module.exportsArgument}[name] = wasmExports[name];`,
|
||||
`if(name) ` +
|
||||
`${module.exportsArgument}[name] = wasmExports[name];`,
|
||||
"// exec imports from WebAssembly module (for esm order)",
|
||||
importsCode,
|
||||
"",
|
||||
|
|
|
@ -209,16 +209,16 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"}"
|
||||
]),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: Template.indent(["installedChunks[chunkId] = 0;"])
|
||||
)};`
|
||||
])
|
||||
])
|
||||
: "// no chunk on demand loading",
|
||||
"",
|
||||
withPrefetch && hasJsMatcher !== false
|
||||
? `${
|
||||
RuntimeGlobals.prefetchChunkHandlers
|
||||
}.j = ${runtimeTemplate.basicFunction("chunkId", [
|
||||
}.j = ${runtimeTemplate.basicFunction("chunkId", [
|
||||
`if((!${
|
||||
RuntimeGlobals.hasOwnProperty
|
||||
}(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${
|
||||
|
@ -232,7 +232,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
crossOriginLoading
|
||||
? `link.crossOrigin = ${JSON.stringify(
|
||||
crossOriginLoading
|
||||
)};`
|
||||
)};`
|
||||
: "",
|
||||
`if (${RuntimeGlobals.scriptNonce}) {`,
|
||||
Template.indent(
|
||||
|
@ -248,13 +248,13 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"document.head.appendChild(link);"
|
||||
]),
|
||||
"}"
|
||||
])};`
|
||||
])};`
|
||||
: "// no prefetching",
|
||||
"",
|
||||
withPreload && hasJsMatcher !== false
|
||||
? `${
|
||||
RuntimeGlobals.preloadChunkHandlers
|
||||
}.j = ${runtimeTemplate.basicFunction("chunkId", [
|
||||
}.j = ${runtimeTemplate.basicFunction("chunkId", [
|
||||
`if((!${
|
||||
RuntimeGlobals.hasOwnProperty
|
||||
}(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${
|
||||
|
@ -290,7 +290,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
)};`
|
||||
),
|
||||
"}"
|
||||
])
|
||||
])
|
||||
: ""
|
||||
]),
|
||||
chunk
|
||||
|
@ -298,7 +298,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"document.head.appendChild(link);"
|
||||
]),
|
||||
"}"
|
||||
])};`
|
||||
])};`
|
||||
: "// no preloaded",
|
||||
"",
|
||||
withHmr
|
||||
|
@ -383,7 +383,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
/\$hmrInvalidateModuleHandlers\$/g,
|
||||
RuntimeGlobals.hmrInvalidateModuleHandlers
|
||||
)
|
||||
])
|
||||
])
|
||||
: "// no HMR",
|
||||
"",
|
||||
withHmrManifest
|
||||
|
@ -400,16 +400,16 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"return response.json();"
|
||||
])});`
|
||||
])};`
|
||||
])
|
||||
])
|
||||
: "// no HMR manifest",
|
||||
"",
|
||||
withOnChunkLoad
|
||||
? `${
|
||||
RuntimeGlobals.onChunksLoaded
|
||||
}.j = ${runtimeTemplate.returningFunction(
|
||||
}.j = ${runtimeTemplate.returningFunction(
|
||||
"installedChunks[chunkId] === 0",
|
||||
"chunkId"
|
||||
)};`
|
||||
)};`
|
||||
: "// no on chunks loaded",
|
||||
"",
|
||||
withCallback || withLoading
|
||||
|
@ -461,7 +461,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
`var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`,
|
||||
"chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));",
|
||||
"chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));"
|
||||
])
|
||||
])
|
||||
: "// no jsonp function"
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
Template.indent("installedChunks[chunkIds.pop()] = 1;"),
|
||||
"parentChunkLoadingFunction(data);"
|
||||
])};`
|
||||
])
|
||||
])
|
||||
: "// no chunk install function needed",
|
||||
withLoading
|
||||
? Template.asString([
|
||||
|
@ -152,14 +152,14 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"}"
|
||||
]),
|
||||
"}"
|
||||
]
|
||||
]
|
||||
: "installedChunks[chunkId] = 1;"
|
||||
)};`,
|
||||
"",
|
||||
`var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`,
|
||||
"var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);",
|
||||
"chunkLoadingGlobal.push = installChunk;"
|
||||
])
|
||||
])
|
||||
: "// no chunk loading",
|
||||
"",
|
||||
withHmr
|
||||
|
@ -215,7 +215,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
/\$hmrInvalidateModuleHandlers\$/g,
|
||||
RuntimeGlobals.hmrInvalidateModuleHandlers
|
||||
)
|
||||
])
|
||||
])
|
||||
: "// no HMR",
|
||||
"",
|
||||
withHmrManifest
|
||||
|
@ -232,7 +232,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
"return response.json();"
|
||||
])});`
|
||||
])};`
|
||||
])
|
||||
])
|
||||
: "// no HMR manifest"
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"eslint-plugin-jest": "^27.6.3",
|
||||
"eslint-plugin-jsdoc": "^43.0.5",
|
||||
"eslint-plugin-n": "^16.6.2",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"file-loader": "^6.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "^8.0.0",
|
||||
"hash-wasm": "^4.9.0",
|
||||
|
@ -84,7 +84,7 @@
|
|||
"mini-svg-data-uri": "^1.2.3",
|
||||
"nyc": "^15.1.0",
|
||||
"open-cli": "^7.2.0",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier": "^3.2.1",
|
||||
"pretty-format": "^29.5.0",
|
||||
"pug": "^3.0.0",
|
||||
"pug-loader": "^2.4.0",
|
||||
|
|
|
@ -25,7 +25,7 @@ const exec = (n, options = {}) => {
|
|||
"--cache-dir",
|
||||
".jest-cache/nyc",
|
||||
process.execPath
|
||||
]
|
||||
]
|
||||
: []),
|
||||
path.resolve(__dirname, "fixtures/buildDependencies/run.js"),
|
||||
n,
|
||||
|
|
|
@ -255,7 +255,7 @@ const describeCases = config => {
|
|||
? children.reduce(
|
||||
(all, { modules }) => all.concat(modules),
|
||||
modules || []
|
||||
)
|
||||
)
|
||||
: modules;
|
||||
if (
|
||||
allModules.some(
|
||||
|
@ -548,7 +548,7 @@ const describeCases = config => {
|
|||
referencingModule.identifier
|
||||
? referencingModule.identifier.slice(
|
||||
esmIdentifier.length + 1
|
||||
)
|
||||
)
|
||||
: fileURLToPath(referencingModule.url)
|
||||
),
|
||||
options,
|
||||
|
@ -634,9 +634,9 @@ const describeCases = config => {
|
|||
) {
|
||||
return testConfig.modules[module];
|
||||
} else {
|
||||
return require(module.startsWith("node:")
|
||||
? module.slice(5)
|
||||
: module);
|
||||
return require(
|
||||
module.startsWith("node:") ? module.slice(5) : module
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ const describeCases = config => {
|
|||
emitOnErrors: true,
|
||||
minimizer: [terserForTesting],
|
||||
...config.optimization
|
||||
}
|
||||
}
|
||||
: {
|
||||
removeAvailableModules: true,
|
||||
removeEmptyChunks: true,
|
||||
|
@ -127,7 +127,7 @@ const describeCases = config => {
|
|||
chunkIds: "size",
|
||||
minimizer: [terserForTesting],
|
||||
...config.optimization
|
||||
},
|
||||
},
|
||||
performance: {
|
||||
hints: false
|
||||
},
|
||||
|
|
|
@ -348,10 +348,9 @@ const describeCases = config => {
|
|||
let testConfig = {};
|
||||
try {
|
||||
// try to load a test file
|
||||
testConfig = require(path.join(
|
||||
testDirectory,
|
||||
"test.config.js"
|
||||
));
|
||||
testConfig = require(
|
||||
path.join(testDirectory, "test.config.js")
|
||||
);
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ module.exports = {
|
|||
},
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
// eslint-disable-next-line n/no-missing-require
|
||||
manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"),
|
||||
name: "../0-create-dll/dll.js",
|
||||
scope: "dll",
|
||||
|
|
|
@ -7,7 +7,6 @@ module.exports = {
|
|||
},
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
// eslint-disable-next-line n/no-missing-require
|
||||
manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"),
|
||||
name: "../0-create-dll/dll.js",
|
||||
scope: "dll",
|
||||
|
|
|
@ -4,7 +4,6 @@ var webpack = require("../../../../");
|
|||
module.exports = {
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
// eslint-disable-next-line n/no-missing-require
|
||||
manifest: require("../../../js/config/dll-plugin-side-effects/manifest0.json"),
|
||||
name: "../0-create-dll/dll.js",
|
||||
scope: "dll",
|
||||
|
|
|
@ -4,7 +4,6 @@ var webpack = require("../../../../");
|
|||
module.exports = {
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
// eslint-disable-next-line n/no-missing-require
|
||||
manifest: require("../../../js/config/dll-plugin/issue-10475.json"),
|
||||
name: "../0-issue-10475/dll.js",
|
||||
scope: "dll",
|
||||
|
|
|
@ -7,7 +7,6 @@ module.exports = {
|
|||
},
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
// eslint-disable-next-line n/no-missing-require
|
||||
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
|
||||
name: "../0-create-dll/dll.js",
|
||||
scope: "dll",
|
||||
|
|
|
@ -26,7 +26,6 @@ module.exports = {
|
|||
},
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
// eslint-disable-next-line n/no-missing-require
|
||||
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
|
||||
name: "../0-create-dll/dll.js",
|
||||
context: path.resolve(__dirname, "../0-create-dll"),
|
||||
|
|
|
@ -23,7 +23,6 @@ module.exports = {
|
|||
},
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
// eslint-disable-next-line n/no-missing-require
|
||||
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
|
||||
name: "../0-create-dll/dll.js",
|
||||
context: path.resolve(__dirname, "../0-create-dll"),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue