diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js index cd4dd8721..94b617df6 100644 --- a/lib/APIPlugin.js +++ b/lib/APIPlugin.js @@ -247,7 +247,7 @@ class APIPlugin { ? new BasicEvaluatedExpression().setNull() : new BasicEvaluatedExpression().setString( parser.state.module.layer - ) + ) ).setRange(expr.range) ); parser.hooks.evaluateTypeof diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index a19143519..0b27a2f67 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -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); } diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index 6e5c3b0f7..534af201a 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -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 diff --git a/lib/Compilation.js b/lib/Compilation.js index 823b0a602..c6a6d0d2a 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -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; } diff --git a/lib/ConcatenationScope.js b/lib/ConcatenationScope.js index 8c26166b1..aa8a0ed71 100644 --- a/lib/ConcatenationScope.js +++ b/lib/ConcatenationScope.js @@ -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"; diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 2100481f2..d39f8f880 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -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, diff --git a/lib/ContextModuleFactory.js b/lib/ContextModuleFactory.js index b30447b87..65a2131bc 100644 --- a/lib/ContextModuleFactory.js +++ b/lib/ContextModuleFactory.js @@ -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"); diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js index b0a47db88..003080806 100644 --- a/lib/EvalDevToolModulePlugin.js +++ b/lib/EvalDevToolModulePlugin.js @@ -82,7 +82,7 @@ class EvalDevToolModulePlugin { compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify( content + footer - )})` + )})` : JSON.stringify(content + footer) });` ); diff --git a/lib/EvalSourceMapDevToolPlugin.js b/lib/EvalSourceMapDevToolPlugin.js index b3803b11d..6cbd7035b 100644 --- a/lib/EvalSourceMapDevToolPlugin.js +++ b/lib/EvalSourceMapDevToolPlugin.js @@ -182,7 +182,7 @@ class EvalSourceMapDevToolPlugin { compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify( content + footer - )})` + )})` : JSON.stringify(content + footer) });` ) diff --git a/lib/ExportsInfoApiPlugin.js b/lib/ExportsInfoApiPlugin.js index 5d469f6bf..faf4594bb 100644 --- a/lib/ExportsInfoApiPlugin.js +++ b/lib/ExportsInfoApiPlugin.js @@ -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; diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index 7b8d46135..d1eb73e62 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -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": diff --git a/lib/ExternalModuleFactoryPlugin.js b/lib/ExternalModuleFactoryPlugin.js index 5dae85c71..bd917ba49 100644 --- a/lib/ExternalModuleFactoryPlugin.js +++ b/lib/ExternalModuleFactoryPlugin.js @@ -192,7 +192,7 @@ class ExternalModuleFactoryPlugin { data.resolveOptions || EMPTY_RESOLVE_OPTIONS, "dependencyType", dependencyType - ) + ) : data.resolveOptions ); if (options) resolver = resolver.withOptions(options); diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index 17f8e7d20..59bf47336 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -3363,7 +3363,7 @@ class FileSystemInfo { : { ...timestamp, ...hash - }; + }; this._contextTshs.set(path, result); callback(null, result); }; diff --git a/lib/FlagDependencyExportsPlugin.js b/lib/FlagDependencyExportsPlugin.js index defbf3781..9befc2544 100644 --- a/lib/FlagDependencyExportsPlugin.js +++ b/lib/FlagDependencyExportsPlugin.js @@ -246,7 +246,7 @@ class FlagDependencyExportsPlugin { from, fromExport === undefined ? [name] : fromExport, priority - )) + )) ) { changed = true; } diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 9e117403c..6a8eb98e1 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -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)); diff --git a/lib/ModuleFilenameHelpers.js b/lib/ModuleFilenameHelpers.js index 236c7ec8d..949a011ee 100644 --- a/lib/ModuleFilenameHelpers.js +++ b/lib/ModuleFilenameHelpers.js @@ -162,7 +162,7 @@ ModuleFilenameHelpers.createFilename = ( ? options : { moduleFilenameTemplate: options - }) + }) }; let absoluteResourcePath; diff --git a/lib/ModuleInfoHeaderPlugin.js b/lib/ModuleInfoHeaderPlugin.js index 2ee0b2a81..0ed0f2527 100644 --- a/lib/ModuleInfoHeaderPlugin.js +++ b/lib/ModuleInfoHeaderPlugin.js @@ -96,7 +96,7 @@ const printExportsInfoToSource = ( .map(e => JSON.stringify(e).slice(1, -1)) .join(".")}` : "" - }` + }` : "" }` ) + "\n" diff --git a/lib/MultiStats.js b/lib/MultiStats.js index d236aef43..4f443bdb4 100644 --- a/lib/MultiStats.js +++ b/lib/MultiStats.js @@ -59,8 +59,8 @@ class MultiStats { ...(typeof childOptions === "string" ? { preset: childOptions } : childOptions && typeof childOptions === "object" - ? childOptions - : undefined) + ? childOptions + : undefined) }, context ); diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 909982bd6..fa0cc1fac 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -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)); diff --git a/lib/NormalModuleFactory.js b/lib/NormalModuleFactory.js index a0d8b767f..9b28c778c 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -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, diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index e4b6a141c..9a50b5825 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -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 { diff --git a/lib/SourceMapDevToolPlugin.js b/lib/SourceMapDevToolPlugin.js index 2bbad9ca8..608fe3024 100644 --- a/lib/SourceMapDevToolPlugin.js +++ b/lib/SourceMapDevToolPlugin.js @@ -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) { diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index 49576bcda..4ba160557 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -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 diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index 9ab0157b6..f77fc8288 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -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; } } diff --git a/lib/cache/IdleFileCachePlugin.js b/lib/cache/IdleFileCachePlugin.js index 8a82644fe..2f913331c 100644 --- a/lib/cache/IdleFileCachePlugin.js +++ b/lib/cache/IdleFileCachePlugin.js @@ -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(); } ); diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index 3462e914c..be0a6a56c 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -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} */ this.buildDependencies = new Set(); diff --git a/lib/cache/ResolverCachePlugin.js b/lib/cache/ResolverCachePlugin.js index 4659d617a..b402731d2 100644 --- a/lib/cache/ResolverCachePlugin.js +++ b/lib/cache/ResolverCachePlugin.js @@ -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 diff --git a/lib/config/browserslistTargetHandler.js b/lib/config/browserslistTargetHandler.js index 6a0e8a739..dea52aec3 100644 --- a/lib/config/browserslistTargetHandler.js +++ b/lib/config/browserslistTargetHandler.js @@ -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); diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 84f08bb42..a01910c8c 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -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 ""; diff --git a/lib/config/normalization.js b/lib/config/normalization.js index 08aaac2a2..a20414eae 100644 --- a/lib/config/normalization.js +++ b/lib/config/normalization.js @@ -109,7 +109,7 @@ const keyedNestedConfig = (value, fn, customKeys) => { obj ), /** @type {Record} */ ({}) - ); + ); 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, diff --git a/lib/container/ContainerReferencePlugin.js b/lib/container/ContainerReferencePlugin.js index f860fbac3..59657c1ff 100644 --- a/lib/container/ContainerReferencePlugin.js +++ b/lib/container/ContainerReferencePlugin.js @@ -113,7 +113,7 @@ class ContainerReferencePlugin { ? external.slice(9) : `webpack/container/reference/${key}${ i ? `/fallback-${i}` : "" - }` + }` ), `.${data.request.slice(key.length)}`, config.shareScope diff --git a/lib/css/CssLoadingRuntimeModule.js b/lib/css/CssLoadingRuntimeModule.js index a37e33f07..3c8226bc4 100644 --- a/lib/css/CssLoadingRuntimeModule.js +++ b/lib/css/CssLoadingRuntimeModule.js @@ -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" ]); } diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 356ca802a..57d4c729c 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -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)}` ); diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js index 98a937d93..ab99938dc 100644 --- a/lib/css/CssParser.js +++ b/lib/css/CssParser.js @@ -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); diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index 3e7158ac4..40b17aef8 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -374,7 +374,7 @@ const makeInterceptorFor = (instance, tracer) => hookName => ({ name, type, fn - }); + }); return { ...tapInfo, fn: newFn diff --git a/lib/dependencies/ContextElementDependency.js b/lib/dependencies/ContextElementDependency.js index 1ceaadb04..cfdcbdcda 100644 --- a/lib/dependencies/ContextElementDependency.js +++ b/lib/dependencies/ContextElementDependency.js @@ -66,7 +66,7 @@ class ContextElementDependency extends ModuleDependency { ? this.referencedExports.map(e => ({ name: e, canMangle: false - })) + })) : Dependency.EXPORTS_OBJECT_REFERENCED; } diff --git a/lib/dependencies/HarmonyAcceptDependency.js b/lib/dependencies/HarmonyAcceptDependency.js index 00a367d82..4817b722d 100644 --- a/lib/dependencies/HarmonyAcceptDependency.js +++ b/lib/dependencies/HarmonyAcceptDependency.js @@ -91,7 +91,7 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends ? HarmonyImportDependency.Template.getImportEmittedRuntime( module, referencedModule - ) + ) : false }; }) diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index bec73a104..e96af33a1 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -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; diff --git a/lib/dependencies/HarmonyExportInitFragment.js b/lib/dependencies/HarmonyExportInitFragment.js index d99137caa..bddeabfb2 100644 --- a/lib/dependencies/HarmonyExportInitFragment.js +++ b/lib/dependencies/HarmonyExportInitFragment.js @@ -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}`; } diff --git a/lib/dependencies/HarmonyImportDependency.js b/lib/dependencies/HarmonyImportDependency.js index b4a655306..2f9c17640 100644 --- a/lib/dependencies/HarmonyImportDependency.js +++ b/lib/dependencies/HarmonyImportDependency.js @@ -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); diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index d0e195e0e..f3b49d243 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -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( diff --git a/lib/dependencies/JsonExportsDependency.js b/lib/dependencies/JsonExportsDependency.js index fb38cc4fe..c688e00e7 100644 --- a/lib/dependencies/JsonExportsDependency.js +++ b/lib/dependencies/JsonExportsDependency.js @@ -28,7 +28,7 @@ const getExportsFromData = data => { canMangle: true, exports: getExportsFromData(item) }; - }) + }) : undefined; } else { const exports = []; diff --git a/lib/dependencies/RequireIncludeDependency.js b/lib/dependencies/RequireIncludeDependency.js index f0ab47c1a..3a25e84a8 100644 --- a/lib/dependencies/RequireIncludeDependency.js +++ b/lib/dependencies/RequireIncludeDependency.js @@ -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}`); diff --git a/lib/dependencies/WebpackIsIncludedDependency.js b/lib/dependencies/WebpackIsIncludedDependency.js index ba41e4e16..0b308734e 100644 --- a/lib/dependencies/WebpackIsIncludedDependency.js +++ b/lib/dependencies/WebpackIsIncludedDependency.js @@ -71,7 +71,7 @@ WebpackIsIncludedDependency.Template = class WebpackIsIncludedDependencyTemplate `__webpack_is_included__ ${runtimeTemplate.requestShortener.shorten( dep.request )}` - ) + ) : ""; source.replace( diff --git a/lib/dependencies/WorkerPlugin.js b/lib/dependencies/WorkerPlugin.js index cdbea3e56..d8933b4b8 100644 --- a/lib/dependencies/WorkerPlugin.js +++ b/lib/dependencies/WorkerPlugin.js @@ -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)); diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index c29f0f50d..5287e70f2 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -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" ]); } diff --git a/lib/hmr/HotModuleReplacement.runtime.js b/lib/hmr/HotModuleReplacement.runtime.js index df191df12..a54aa0e62 100644 --- a/lib/hmr/HotModuleReplacement.runtime.js +++ b/lib/hmr/HotModuleReplacement.runtime.js @@ -288,8 +288,7 @@ module.exports = function () { updatedModules ); return promises; - }, - []) + }, []) ).then(function () { return waitForBlockingPromises(function () { if (applyOnUpdate) { diff --git a/lib/hmr/lazyCompilationBackend.js b/lib/hmr/lazyCompilationBackend.js index 3f4805559..dcc0130d1 100644 --- a/lib/hmr/lazyCompilationBackend.js +++ b/lib/hmr/lazyCompilationBackend.js @@ -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}.` ); diff --git a/lib/ids/DeterministicModuleIdsPlugin.js b/lib/ids/DeterministicModuleIdsPlugin.js index 6f19f66f2..0cfd973ae 100644 --- a/lib/ids/DeterministicModuleIdsPlugin.js +++ b/lib/ids/DeterministicModuleIdsPlugin.js @@ -66,7 +66,7 @@ class DeterministicModuleIdsPlugin { ? () => 0 : compareModulesByPreOrderIndexOrIdentifier( compilation.moduleGraph - ), + ), (module, id) => { const size = usedIds.size; usedIds.add(`${id}`); diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 6eb79e705..4249a2f51 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -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} */ (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;" diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index e232bd37b..b1657686a 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -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) { diff --git a/lib/library/SystemLibraryPlugin.js b/lib/library/SystemLibraryPlugin.js index 3795985b5..06fdabe34 100644 --- a/lib/library/SystemLibraryPlugin.js +++ b/lib/library/SystemLibraryPlugin.js @@ -187,7 +187,7 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin { .join(",\n") ), "]," - ]); + ]); return new ConcatSource( Template.asString([ diff --git a/lib/library/UmdLibraryPlugin.js b/lib/library/UmdLibraryPlugin.js index fbcb0717c..34a2af285 100644 --- a/lib/library/UmdLibraryPlugin.js +++ b/lib/library/UmdLibraryPlugin.js @@ -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)}) =>` diff --git a/lib/node/ReadFileChunkLoadingRuntimeModule.js b/lib/node/ReadFileChunkLoadingRuntimeModule.js index eac29d9c6..5a715c9b5 100644 --- a/lib/node/ReadFileChunkLoadingRuntimeModule.js +++ b/lib/node/ReadFileChunkLoadingRuntimeModule.js @@ -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" ]); } diff --git a/lib/node/RequireChunkLoadingRuntimeModule.js b/lib/node/RequireChunkLoadingRuntimeModule.js index f0b37b099..b03575af4 100644 --- a/lib/node/RequireChunkLoadingRuntimeModule.js +++ b/lib/node/RequireChunkLoadingRuntimeModule.js @@ -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" ]); } diff --git a/lib/node/nodeConsole.js b/lib/node/nodeConsole.js index 64dcd11d1..24676d118 100644 --- a/lib/node/nodeConsole.js +++ b/lib/node/nodeConsole.js @@ -132,6 +132,6 @@ module.exports = ({ colors, appendOnly, stream }) => { currentStatusMessage = [name, ...args]; writeStatusMessage(); } - } + } }; }; diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index f889b5e20..87466ae90 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -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); diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index 7b0adfa81..944bfa09d 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -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( diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index d7c3f9369..cd1e7fce0 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -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; diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index 2e79ab6a2..d430df495 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -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 diff --git a/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js b/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js index 95f097113..740bbe8c3 100644 --- a/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +++ b/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js @@ -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);` ) ); diff --git a/lib/runtime/AutoPublicPathRuntimeModule.js b/lib/runtime/AutoPublicPathRuntimeModule.js index 60cf1b295..cc62fc811 100644 --- a/lib/runtime/AutoPublicPathRuntimeModule.js +++ b/lib/runtime/AutoPublicPathRuntimeModule.js @@ -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 - )};` + )};` ]); } } diff --git a/lib/runtime/GetChunkFilenameRuntimeModule.js b/lib/runtime/GetChunkFilenameRuntimeModule.js index 1ca4cd8a3..6dab9cdfd 100644 --- a/lib/runtime/GetChunkFilenameRuntimeModule.js +++ b/lib/runtime/GetChunkFilenameRuntimeModule.js @@ -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};`] )};` ]); diff --git a/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js b/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js index 9710561fa..a61e1114b 100644 --- a/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +++ b/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js @@ -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 { )}');` ]), "}" - ] + ] : []) ]), "}" - ] + ] : []) ]), "}", diff --git a/lib/runtime/LoadScriptRuntimeModule.js b/lib/runtime/LoadScriptRuntimeModule.js index 2b0bb7bb5..9ed64dbd8 100644 --- a/lib/runtime/LoadScriptRuntimeModule.js +++ b/lib/runtime/LoadScriptRuntimeModule.js @@ -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)};` ), "}" - ]) + ]) : "" ]); diff --git a/lib/runtime/StartupChunkDependenciesRuntimeModule.js b/lib/runtime/StartupChunkDependenciesRuntimeModule.js index 0a4aae68e..90f3d92f2 100644 --- a/lib/runtime/StartupChunkDependenciesRuntimeModule.js +++ b/lib/runtime/StartupChunkDependenciesRuntimeModule.js @@ -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);" + ] )};` ]); } diff --git a/lib/runtime/StartupEntrypointRuntimeModule.js b/lib/runtime/StartupEntrypointRuntimeModule.js index 6d8dc0e97..5133767da 100644 --- a/lib/runtime/StartupEntrypointRuntimeModule.js +++ b/lib/runtime/StartupEntrypointRuntimeModule.js @@ -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;" - ]) + ]) ])}`; } } diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index afc15f97d..a7c7dae09 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -200,7 +200,7 @@ class Lockfile { : { resolved: key, ...entry - } + } ); } return lockfile; diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index be4b36502..f93543def 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -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 diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index 31890dfe8..7c7f59c33 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -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; } diff --git a/lib/sharing/ConsumeSharedPlugin.js b/lib/sharing/ConsumeSharedPlugin.js index 1d8eb3ebd..3c8923185 100644 --- a/lib/sharing/ConsumeSharedPlugin.js +++ b/lib/sharing/ConsumeSharedPlugin.js @@ -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) => ({ diff --git a/lib/sharing/ConsumeSharedRuntimeModule.js b/lib/sharing/ConsumeSharedRuntimeModule.js index 2470feb50..223faccee 100644 --- a/lib/sharing/ConsumeSharedRuntimeModule.js +++ b/lib/sharing/ConsumeSharedRuntimeModule.js @@ -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" ]); } diff --git a/lib/sharing/ProvideSharedModule.js b/lib/sharing/ProvideSharedModule.js index ae8e38dce..40796dd7b 100644 --- a/lib/sharing/ProvideSharedModule.js +++ b/lib/sharing/ProvideSharedModule.js @@ -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(); diff --git a/lib/sharing/SharePlugin.js b/lib/sharing/SharePlugin.js index ccbd9bbdd..65935b30b 100644 --- a/lib/sharing/SharePlugin.js +++ b/lib/sharing/SharePlugin.js @@ -34,11 +34,11 @@ class SharePlugin { item === key || !isRequiredVersion(item) ? { import: item - } + } : { import: key, requiredVersion: item - }; + }; return config; }, item => item diff --git a/lib/sharing/ShareRuntimeModule.js b/lib/sharing/ShareRuntimeModule.js index a9c666850..0f63ef68d 100644 --- a/lib/sharing/ShareRuntimeModule.js +++ b/lib/sharing/ShareRuntimeModule.js @@ -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( diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index a18aa475c..70f0998be 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -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) diff --git a/lib/stats/DefaultStatsPresetPlugin.js b/lib/stats/DefaultStatsPresetPlugin.js index d49cad990..983755904 100644 --- a/lib/stats/DefaultStatsPresetPlugin.js +++ b/lib/stats/DefaultStatsPresetPlugin.js @@ -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, diff --git a/lib/stats/DefaultStatsPrinterPlugin.js b/lib/stats/DefaultStatsPrinterPlugin.js index 20b19adc8..7821075ae 100644 --- a/lib/stats/DefaultStatsPrinterPlugin.js +++ b/lib/stats/DefaultStatsPrinterPlugin.js @@ -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 { diff --git a/lib/util/cleverMerge.js b/lib/util/cleverMerge.js index f86934cc5..1621cc799 100644 --- a/lib/util/cleverMerge.js +++ b/lib/util/cleverMerge.js @@ -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; diff --git a/lib/util/identifier.js b/lib/util/identifier.js index ea5ec2eaa..659988163 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -376,6 +376,6 @@ exports.getUndoPath = (filename, outputPath, enforceRelative) => { return depth > 0 ? `${"../".repeat(depth)}${append}` : enforceRelative - ? `./${append}` - : append; + ? `./${append}` + : append; }; diff --git a/lib/util/semver.js b/lib/util/semver.js index 545891e06..b74800797 100644 --- a/lib/util/semver.js +++ b/lib/util/semver.js @@ -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 diff --git a/lib/util/smartGrouping.js b/lib/util/smartGrouping.js index ae4132a60..01d1d4bec 100644 --- a/lib/util/smartGrouping.js +++ b/lib/util/smartGrouping.js @@ -145,7 +145,7 @@ const smartGrouping = (items, groupConfigs) => { (totalSize * 2) / targetGroupCount + itemsWithGroups.size - items.size - ); + ); if ( sizeValue > bestGroupSize || (force && (!bestGroupOptions || !bestGroupOptions.force)) diff --git a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js index 651758727..29b4b08d1 100644 --- a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +++ b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js @@ -69,7 +69,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule { ]) ]), "}" - ]) + ]) : "// no support for streaming compilation", "return req", Template.indent([ diff --git a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js index baa713330..663504dd1 100644 --- a/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +++ b/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js @@ -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};` ); diff --git a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js index d5265c965..ed01c4f13 100644 --- a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +++ b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js @@ -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(); });", diff --git a/lib/wasm-sync/WebAssemblyJavascriptGenerator.js b/lib/wasm-sync/WebAssemblyJavascriptGenerator.js index 448ae7b7a..1b5ca88df 100644 --- a/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +++ b/lib/wasm-sync/WebAssemblyJavascriptGenerator.js @@ -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, "", diff --git a/lib/web/JsonpChunkLoadingRuntimeModule.js b/lib/web/JsonpChunkLoadingRuntimeModule.js index 32e12f5e5..32d37577f 100644 --- a/lib/web/JsonpChunkLoadingRuntimeModule.js +++ b/lib/web/JsonpChunkLoadingRuntimeModule.js @@ -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" ]); } diff --git a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js index f1068d012..a17b92bef 100644 --- a/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +++ b/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js @@ -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" ]); } diff --git a/package.json b/package.json index 61c16cf31..46ae30114 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/BuildDependencies.longtest.js b/test/BuildDependencies.longtest.js index f5b7c6444..2127fc37c 100644 --- a/test/BuildDependencies.longtest.js +++ b/test/BuildDependencies.longtest.js @@ -25,7 +25,7 @@ const exec = (n, options = {}) => { "--cache-dir", ".jest-cache/nyc", process.execPath - ] + ] : []), path.resolve(__dirname, "fixtures/buildDependencies/run.js"), n, diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index de75e306b..c45b855ff 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -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 + ); } }; diff --git a/test/TestCases.template.js b/test/TestCases.template.js index 43619be9b..81452852e 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -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 }, diff --git a/test/WatchTestCases.template.js b/test/WatchTestCases.template.js index 68dbce53a..51aec382e 100644 --- a/test/WatchTestCases.template.js +++ b/test/WatchTestCases.template.js @@ -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 } diff --git a/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js index 4cb0ca0bb..9db6069b1 100644 --- a/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js @@ -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", diff --git a/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js index 4cb0ca0bb..9db6069b1 100644 --- a/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js +++ b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js @@ -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", diff --git a/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js b/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js index 62558963d..97da7ef58 100644 --- a/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin-side-effects/1-use-dll/webpack.config.js @@ -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", diff --git a/test/configCases/dll-plugin/1-issue-10475/webpack.config.js b/test/configCases/dll-plugin/1-issue-10475/webpack.config.js index 388033831..64ccc2bd2 100644 --- a/test/configCases/dll-plugin/1-issue-10475/webpack.config.js +++ b/test/configCases/dll-plugin/1-issue-10475/webpack.config.js @@ -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", diff --git a/test/configCases/dll-plugin/1-use-dll/webpack.config.js b/test/configCases/dll-plugin/1-use-dll/webpack.config.js index 92f315cf1..e1d2044fc 100644 --- a/test/configCases/dll-plugin/1-use-dll/webpack.config.js +++ b/test/configCases/dll-plugin/1-use-dll/webpack.config.js @@ -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", diff --git a/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js b/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js index b7d736bfd..3dabdbd25 100644 --- a/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js +++ b/test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js @@ -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"), diff --git a/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js b/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js index 4df22aed0..9276c2d77 100644 --- a/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js +++ b/test/configCases/dll-plugin/3-use-dll-with-hashid/webpack.config.js @@ -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"), diff --git a/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js b/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js index 370e97826..bd045cd8b 100644 --- a/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js +++ b/test/configCases/dll-plugin/4-use-dll-with-contenthash/webpack.config.js @@ -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-with-contenthash/dll.js", scope: "dll", diff --git a/test/configCases/process-assets/html-plugin/webpack.config.js b/test/configCases/process-assets/html-plugin/webpack.config.js index f1b74d57e..98abbd484 100644 --- a/test/configCases/process-assets/html-plugin/webpack.config.js +++ b/test/configCases/process-assets/html-plugin/webpack.config.js @@ -65,8 +65,8 @@ class HtmlPlugin { contenthash: Array.isArray(assetInfo.contenthash) ? [...new Set([...assetInfo.contenthash, integrity])] : assetInfo.contenthash - ? [assetInfo.contenthash, integrity] - : integrity + ? [assetInfo.contenthash, integrity] + : integrity }) ); return `