diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 594054e1415..577688a4a3c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -161,7 +161,7 @@ jobs: yarn --frozen-lockfile --ignore-engines if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' - run: | - yarn upgrade eslint-plugin-jest@~28.4.0 eslint-plugin-jsdoc@^47.0.0 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 nyc@^15.1.0 + yarn upgrade eslint-plugin-jest@~28.4.0 eslint-plugin-jsdoc@^47.0.0 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 nyc@^15.1.0 @eslint/js@^8 yarn --frozen-lockfile if: matrix.node-version == '16.x' # Install main version of our deps diff --git a/bin/webpack.js b/bin/webpack.js index 4d50702f596..3af7d8f6d90 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -91,7 +91,7 @@ const runCli = cli => { }; /** - * @typedef {Object} CliOption + * @typedef {object} CliOption * @property {string} name display name * @property {string} package npm package name * @property {string} binName name of the executable file diff --git a/eslint.config.js b/eslint.config.js index b65f6690513..a4ef0fec3df 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -80,29 +80,13 @@ module.exports = [ "jsdoc/check-alignment": "off", "jsdoc/tag-lines": "off", // TODO enable me - "jsdoc/check-types": "off", - // TODO enable me "jsdoc/valid-types": "off", // TODO remove me after switch to typescript strict mode "jsdoc/require-jsdoc": "off", "jsdoc/require-returns-check": "off", - // TODO remove duplication from recommended "jsdoc/check-indentation": "error", - "jsdoc/check-param-names": "error", - "jsdoc/check-property-names": "error", - "jsdoc/check-tag-names": "error", "jsdoc/require-hyphen-before-param-description": ["error", "never"], - "jsdoc/require-param-description": "error", - "jsdoc/require-param-name": "error", - "jsdoc/require-param-type": "error", - "jsdoc/require-param": "error", - "jsdoc/require-property": "error", - "jsdoc/require-property-name": "error", - "jsdoc/require-property-type": "error", "jsdoc/require-property-description": "off", - "jsdoc/require-returns-description": "error", - "jsdoc/require-returns-type": "error", - "jsdoc/require-returns": "error", // Disallow @ts-ignore directive. Use @ts-expect-error instead "no-warning-comments": [ "error", @@ -134,9 +118,6 @@ module.exports = [ inheritdoc: false, class: "constructor" }, - preferredTypes: { - object: "Object" - }, overrideReplacesDocs: false } } diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js index 998dd565fd5..f76f77141ef 100644 --- a/lib/APIPlugin.js +++ b/lib/APIPlugin.js @@ -133,7 +133,7 @@ function getReplacements(module, importMetaName) { const PLUGIN_NAME = "APIPlugin"; /** - * @typedef {Object} APIPluginOptions + * @typedef {object} APIPluginOptions * @property {boolean} [module] the output filename */ diff --git a/lib/Cache.js b/lib/Cache.js index 68f63e9b042..8d982e1038c 100644 --- a/lib/Cache.js +++ b/lib/Cache.js @@ -14,7 +14,7 @@ const { /** @typedef {import("./WebpackError")} WebpackError */ /** - * @typedef {Object} Etag + * @typedef {object} Etag * @property {function(): string} toString */ diff --git a/lib/Chunk.js b/lib/Chunk.js index e685192f010..e308eae74e2 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -38,13 +38,13 @@ const { mergeRuntime } = require("./util/runtime"); const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files"); /** - * @typedef {Object} WithId an object who has an id property * + * @typedef {object} WithId an object who has an id property * * @property {string | number} id the id of the object */ /** * @deprecated - * @typedef {Object} ChunkMaps + * @typedef {object} ChunkMaps * @property {Record} hash * @property {Record>} contentHash * @property {Record} name @@ -52,7 +52,7 @@ const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files"); /** * @deprecated - * @typedef {Object} ChunkModuleMaps + * @typedef {object} ChunkModuleMaps * @property {Record} id * @property {Record} hash */ diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js index 3afd3f2088d..190256b2de0 100644 --- a/lib/ChunkGraph.js +++ b/lib/ChunkGraph.js @@ -50,7 +50,7 @@ const compareModuleIterables = compareIterables(compareModulesByIdentifier); /** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */ /** - * @typedef {Object} ChunkSizeOptions + * @typedef {object} ChunkSizeOptions * @property {number=} chunkOverhead constant overhead for a chunk * @property {number=} entryChunkMultiplicator multiplicator for initial chunks */ diff --git a/lib/ChunkGroup.js b/lib/ChunkGroup.js index c5f255b4e86..a951cf3a750 100644 --- a/lib/ChunkGroup.js +++ b/lib/ChunkGroup.js @@ -25,7 +25,7 @@ const { /** @typedef {{module: Module, loc: DependencyLocation, request: string}} OriginRecord */ /** - * @typedef {Object} RawChunkGroupOptions + * @typedef {object} RawChunkGroupOptions * @property {number=} preloadOrder * @property {number=} prefetchOrder * @property {("low" | "high" | "auto")=} fetchPriority diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js index 202f9dc986c..1bae3ed9c1e 100644 --- a/lib/CleanPlugin.js +++ b/lib/CleanPlugin.js @@ -24,7 +24,7 @@ const processAsyncTree = require("./util/processAsyncTree"); /** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */ /** - * @typedef {Object} CleanPluginCompilationHooks + * @typedef {object} CleanPluginCompilationHooks * @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config */ diff --git a/lib/Compilation.js b/lib/Compilation.js index 089dd69992c..40b6052db41 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -168,20 +168,20 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {Record} CompilationAssets */ /** - * @typedef {Object} AvailableModulesChunkGroupMapping + * @typedef {object} AvailableModulesChunkGroupMapping * @property {ChunkGroup} chunkGroup * @property {Set} availableModules * @property {boolean} needCopy */ /** - * @typedef {Object} DependenciesBlockLike + * @typedef {object} DependenciesBlockLike * @property {Dependency[]} dependencies * @property {AsyncDependenciesBlock[]} blocks */ /** - * @typedef {Object} ChunkPathData + * @typedef {object} ChunkPathData * @property {string|number} id * @property {string=} name * @property {string} hash @@ -191,7 +191,7 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} ChunkHashContext + * @typedef {object} ChunkHashContext * @property {CodeGenerationResults} codeGenerationResults results of code generation * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph @@ -199,18 +199,18 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} RuntimeRequirementsContext + * @typedef {object} RuntimeRequirementsContext * @property {ChunkGraph} chunkGraph the chunk graph * @property {CodeGenerationResults} codeGenerationResults the code generation results */ /** - * @typedef {Object} ExecuteModuleOptions + * @typedef {object} ExecuteModuleOptions * @property {EntryOptions=} entryOptions */ /** - * @typedef {Object} ExecuteModuleResult + * @typedef {object} ExecuteModuleResult * @property {any} exports * @property {boolean} cacheable * @property {Map} assets @@ -221,7 +221,7 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} ExecuteModuleArgument + * @typedef {object} ExecuteModuleArgument * @property {Module} module * @property {{ id: string, exports: any, loaded: boolean }=} moduleObject * @property {any} preparedInfo @@ -229,7 +229,7 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} ExecuteModuleContext + * @typedef {object} ExecuteModuleContext * @property {Map} assets * @property {Chunk} chunk * @property {ChunkGraph} chunkGraph @@ -237,14 +237,14 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} EntryData + * @typedef {object} EntryData * @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup * @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated * @property {EntryOptions} options options of the entrypoint */ /** - * @typedef {Object} LogEntry + * @typedef {object} LogEntry * @property {string} type * @property {any[]} args * @property {number} time @@ -252,7 +252,7 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} KnownAssetInfo + * @typedef {object} KnownAssetInfo * @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash) * @property {boolean=} minimized whether the asset is minimized * @property {string | string[]=} fullhash the value(s) of the full hash used for this asset @@ -270,21 +270,21 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {KnownAssetInfo & Record} AssetInfo */ /** - * @typedef {Object} Asset + * @typedef {object} Asset * @property {string} name the filename of the asset * @property {Source} source source of the asset * @property {AssetInfo} info info about the asset */ /** - * @typedef {Object} ModulePathData + * @typedef {object} ModulePathData * @property {string|number} id * @property {string} hash * @property {function(number): string=} hashWithLength */ /** - * @typedef {Object} PathData + * @typedef {object} PathData * @property {ChunkGraph=} chunkGraph * @property {string=} hash * @property {function(number): string=} hashWithLength @@ -302,7 +302,7 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} KnownNormalizedStatsOptions + * @typedef {object} KnownNormalizedStatsOptions * @property {string} context * @property {RequestShortener} requestShortener * @property {string} chunksSort @@ -346,7 +346,7 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {KnownNormalizedStatsOptions & Omit & Record} NormalizedStatsOptions */ /** - * @typedef {Object} KnownCreateStatsOptionsContext + * @typedef {object} KnownCreateStatsOptionsContext * @property {boolean=} forToString */ @@ -1793,7 +1793,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } /** - * @typedef {Object} HandleModuleCreationOptions + * @typedef {object} HandleModuleCreationOptions * @property {ModuleFactory} factory * @property {Dependency[]} dependencies * @property {Module | null} originModule @@ -2128,7 +2128,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } /** - * @param {Object} options options + * @param {object} options options * @param {string} options.context context string path * @param {Dependency} options.dependency dependency used to create Module chain * @param {Partial=} options.contextInfo additional context info for the root module @@ -2567,7 +2567,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si }; /** * @param {Module} module module - * @param {Object} references references + * @param {object} references references * @param {string | number} references.id id * @param {Map=} references.modules modules * @param {(string | number | null)[]=} references.blocks blocks @@ -3515,7 +3515,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } /** - * @param {Object} options options + * @param {object} options options * @param {ChunkGraph=} options.chunkGraph the chunk graph * @param {Iterable=} options.modules modules * @param {Iterable=} options.chunks chunks @@ -5343,7 +5343,7 @@ This prevents using hashes of each other and should be avoided.`); } /** - * @typedef {Object} FactorizeModuleOptions + * @typedef {object} FactorizeModuleOptions * @property {ModuleProfile} currentProfile * @property {ModuleFactory} factory * @property {Dependency[]} dependencies diff --git a/lib/Compiler.js b/lib/Compiler.js index 3ccca59036f..80e75e46725 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -55,7 +55,7 @@ const { isSourceEqual } = require("./util/source"); /** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ /** - * @typedef {Object} CompilationParams + * @typedef {object} CompilationParams * @property {NormalModuleFactory} normalModuleFactory * @property {ContextModuleFactory} contextModuleFactory */ @@ -82,7 +82,7 @@ const { isSourceEqual } = require("./util/source"); */ /** - * @typedef {Object} AssetEmittedInfo + * @typedef {object} AssetEmittedInfo * @property {Buffer} content * @property {Source} source * @property {Compilation} compilation @@ -105,12 +105,12 @@ const isSorted = array => { }; /** - * @param {Object} obj an object + * @param {{[key: string]: any}} obj an object * @param {string[]} keys the keys of the object - * @returns {Object} the object with properties sorted by property name + * @returns {{[key: string]: any}} the object with properties sorted by property name */ const sortObject = (obj, keys) => { - /** @type {Object} */ + /** @type {{[key: string]: any}} */ const o = {}; for (const k of keys.sort()) { o[k] = obj[k]; diff --git a/lib/ConcatenationScope.js b/lib/ConcatenationScope.js index aa8a0ed7189..c9d0fbc7af6 100644 --- a/lib/ConcatenationScope.js +++ b/lib/ConcatenationScope.js @@ -14,13 +14,13 @@ const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__"; const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__"; /** - * @typedef {Object} ExternalModuleInfo + * @typedef {object} ExternalModuleInfo * @property {number} index * @property {Module} module */ /** - * @typedef {Object} ConcatenatedModuleInfo + * @typedef {object} ConcatenatedModuleInfo * @property {number} index * @property {Module} module * @property {Map} exportMap mapping from export name to symbol @@ -31,7 +31,7 @@ const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__"; /** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */ /** - * @typedef {Object} ModuleReferenceOptions + * @typedef {object} ModuleReferenceOptions * @property {string[]} ids the properties/exports of the module * @property {boolean} call true, when this referenced export is called * @property {boolean} directImport true, when this referenced export is directly imported (not via property access) @@ -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 0c6f6f4ca1b..50505316392 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -57,7 +57,7 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */ /** - * @typedef {Object} ContextOptions + * @typedef {object} ContextOptions * @property {ContextMode} mode * @property {boolean} recursive * @property {RegExp} regExp @@ -75,7 +75,7 @@ const makeSerializable = require("./util/makeSerializable"); */ /** - * @typedef {Object} ContextModuleOptionsExtras + * @typedef {object} ContextModuleOptionsExtras * @property {false|string|string[]} resource * @property {string=} resourceQuery * @property {string=} resourceFragment @@ -532,8 +532,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) => { @@ -784,7 +784,7 @@ module.exports = webpackContext;`; /** * @param {Dependency[]} dependencies dependencies * @param {ModuleId} id module id - * @param {Object} context context + * @param {object} context context * @param {ChunkGraph} context.chunkGraph the chunk graph * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph * @returns {string} source code @@ -833,7 +833,7 @@ module.exports = webpackAsyncContext;`; /** * @param {Dependency[]} dependencies dependencies * @param {ModuleId} id module id - * @param {Object} context context + * @param {object} context context * @param {ChunkGraph} context.chunkGraph the chunk graph * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph * @returns {string} source code @@ -878,7 +878,7 @@ module.exports = webpackAsyncContext;`; * @param {AsyncDependenciesBlock} block block * @param {Dependency[]} dependencies dependencies * @param {ModuleId} id module id - * @param {Object} options options object + * @param {object} options options object * @param {RuntimeTemplate} options.runtimeTemplate the runtime template * @param {ChunkGraph} options.chunkGraph the chunk graph * @returns {string} source code @@ -927,7 +927,7 @@ module.exports = webpackAsyncContext;`; /** * @param {AsyncDependenciesBlock[]} blocks blocks * @param {ModuleId} id module id - * @param {Object} context context + * @param {object} context context * @param {ChunkGraph} context.chunkGraph the chunk graph * @param {RuntimeTemplate} context.runtimeTemplate the chunk graph * @returns {string} source code @@ -992,8 +992,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/DefinePlugin.js b/lib/DefinePlugin.js index dca73054476..ed0fd99dff7 100644 --- a/lib/DefinePlugin.js +++ b/lib/DefinePlugin.js @@ -35,7 +35,7 @@ const createHash = require("./util/createHash"); /** @typedef {RecursiveArrayOrRecord} CodeValue */ /** - * @typedef {Object} RuntimeValueOptions + * @typedef {object} RuntimeValueOptions * @property {string[]=} fileDependencies * @property {string[]=} contextDependencies * @property {string[]=} missingDependencies @@ -576,7 +576,7 @@ class DefinePlugin { /** * Apply Object * @param {string} key Key - * @param {Object} obj Object + * @param {object} obj Object * @returns {void} */ const applyObjectDefine = (key, obj) => { diff --git a/lib/Dependency.js b/lib/Dependency.js index 6b8a8b5edeb..84b4736912f 100644 --- a/lib/Dependency.js +++ b/lib/Dependency.js @@ -24,27 +24,27 @@ const memoize = require("./util/memoize"); /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} UpdateHashContext + * @typedef {object} UpdateHashContext * @property {ChunkGraph} chunkGraph * @property {RuntimeSpec} runtime * @property {RuntimeTemplate=} runtimeTemplate */ /** - * @typedef {Object} SourcePosition + * @typedef {object} SourcePosition * @property {number} line * @property {number=} column */ /** - * @typedef {Object} RealDependencyLocation + * @typedef {object} RealDependencyLocation * @property {SourcePosition} start * @property {SourcePosition=} end * @property {number=} index */ /** - * @typedef {Object} SyntheticDependencyLocation + * @typedef {object} SyntheticDependencyLocation * @property {string} name * @property {number=} index */ @@ -52,7 +52,7 @@ const memoize = require("./util/memoize"); /** @typedef {SyntheticDependencyLocation | RealDependencyLocation} DependencyLocation */ /** - * @typedef {Object} ExportSpec + * @typedef {object} ExportSpec * @property {string} name the name of the export * @property {boolean=} canMangle can the export be renamed (defaults to true) * @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts @@ -64,7 +64,7 @@ const memoize = require("./util/memoize"); */ /** - * @typedef {Object} ExportsSpec + * @typedef {object} ExportsSpec * @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports * @property {Set=} excludeExports when exports = true, list of unaffected exports * @property {Set=} hideExports list of maybe prior exposed, but now hidden exports @@ -76,7 +76,7 @@ const memoize = require("./util/memoize"); */ /** - * @typedef {Object} ReferencedExport + * @typedef {object} ReferencedExport * @property {string[]} name name of the referenced export * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true */ diff --git a/lib/DependencyTemplate.js b/lib/DependencyTemplate.js index 441941185e8..84d9d7cda7e 100644 --- a/lib/DependencyTemplate.js +++ b/lib/DependencyTemplate.js @@ -24,7 +24,7 @@ */ /** - * @typedef {Object} DependencyTemplateContext + * @typedef {object} DependencyTemplateContext * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {DependencyTemplates} dependencyTemplates the dependency templates * @property {ModuleGraph} moduleGraph the module graph @@ -39,12 +39,12 @@ */ /** - * @typedef {Object} CssDependencyTemplateContextExtras + * @typedef {object} CssDependencyTemplateContextExtras * @property {CssExportsData} cssExportsData the css exports data */ /** - * @typedef {Object} CssExportsData + * @typedef {object} CssExportsData * @property {boolean} esModule whether export __esModule * @property {Map} exports the css exports */ diff --git a/lib/DllReferencePlugin.js b/lib/DllReferencePlugin.js index be70de5ae1e..674a9457c01 100644 --- a/lib/DllReferencePlugin.js +++ b/lib/DllReferencePlugin.js @@ -35,7 +35,7 @@ class DllReferencePlugin { constructor(options) { validate(options); this.options = options; - /** @type {WeakMap} */ + /** @type {WeakMap} */ this._compilationData = new WeakMap(); } diff --git a/lib/EvalDevToolModulePlugin.js b/lib/EvalDevToolModulePlugin.js index 7995f106d2c..e1bd8d20e1c 100644 --- a/lib/EvalDevToolModulePlugin.js +++ b/lib/EvalDevToolModulePlugin.js @@ -29,7 +29,7 @@ const devtoolWarning = new RawSource(`/* `); /** - * @typedef {Object} EvalDevToolModulePluginOptions + * @typedef {object} EvalDevToolModulePluginOptions * @property {OutputOptions["devtoolNamespace"]=} namespace namespace * @property {string=} sourceUrlComment source url comment * @property {OutputOptions["devtoolModuleFilenameTemplate"]=} moduleFilenameTemplate module filename template @@ -93,7 +93,7 @@ class EvalDevToolModulePlugin { compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify( content + footer - )})` + )})` : JSON.stringify(content + footer) });` ); diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index fb1c86ca759..9be5a575850 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -59,7 +59,7 @@ const { register } = require("./util/serialization"); /** @typedef {ImportDependencyMeta | CssImportDependencyMeta} DependencyMeta */ /** - * @typedef {Object} SourceData + * @typedef {object} SourceData * @property {boolean=} iife * @property {string=} init * @property {string} expression @@ -175,7 +175,7 @@ const getSourceForImportExternal = ( ? `, { assert: ${JSON.stringify( dependencyMeta.attributes, importAssertionReplacer - )} }` + )} }` : `, { with: ${JSON.stringify(dependencyMeta.attributes)} }` : ""; if (!Array.isArray(moduleAndSpecifiers)) { @@ -244,7 +244,7 @@ class ModuleExternalInitFragment extends InitFragment { ? ` assert ${JSON.stringify( dependencyMeta.attributes, importAssertionReplacer - )}` + )}` : ` with ${JSON.stringify(dependencyMeta.attributes)}` : "" };\n`, @@ -360,10 +360,10 @@ const getSourceForModuleExternal = ( ? `var x = ${runtimeTemplate.basicFunction( "y", `var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x` - )} \nvar y = ${runtimeTemplate.returningFunction( + )} \nvar y = ${runtimeTemplate.returningFunction( runtimeTemplate.returningFunction("x"), "x" - )}` + )}` : undefined, runtimeRequirements: moduleRemapping ? RUNTIME_REQUIREMENTS_FOR_MODULE @@ -443,7 +443,7 @@ const getSourceForAmdOrUmdExternal = ( externalVariable, Array.isArray(request) ? request.join(".") : request, runtimeTemplate - ) + ) : undefined, expression: externalVariable }; @@ -703,7 +703,7 @@ class ExternalModule extends Module { /** @type {string} */ (runtimeTemplate.outputOptions.importMetaName), runtimeTemplate.supportNodePrefixForCoreModules() - ) + ) : getSourceForCommonJsExternal(request); case "amd": case "amd-require": diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index e5558240c6a..94f9740459c 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -46,19 +46,19 @@ const RBDT_FILE_DEPENDENCIES = 9; const INVALID = Symbol("invalid"); /** - * @typedef {Object} FileSystemInfoEntry + * @typedef {object} FileSystemInfoEntry * @property {number} safeTime * @property {number=} timestamp */ /** - * @typedef {Object} ResolvedContextFileSystemInfoEntry + * @typedef {object} ResolvedContextFileSystemInfoEntry * @property {number} safeTime * @property {string=} timestampHash */ /** - * @typedef {Object} ContextFileSystemInfoEntry + * @typedef {object} ContextFileSystemInfoEntry * @property {number} safeTime * @property {string=} timestampHash * @property {ResolvedContextFileSystemInfoEntry=} resolved @@ -66,21 +66,21 @@ const INVALID = Symbol("invalid"); */ /** - * @typedef {Object} TimestampAndHash + * @typedef {object} TimestampAndHash * @property {number} safeTime * @property {number=} timestamp * @property {string} hash */ /** - * @typedef {Object} ResolvedContextTimestampAndHash + * @typedef {object} ResolvedContextTimestampAndHash * @property {number} safeTime * @property {string=} timestampHash * @property {string} hash */ /** - * @typedef {Object} ContextTimestampAndHash + * @typedef {object} ContextTimestampAndHash * @property {number} safeTime * @property {string=} timestampHash * @property {string} hash @@ -89,14 +89,14 @@ const INVALID = Symbol("invalid"); */ /** - * @typedef {Object} ContextHash + * @typedef {object} ContextHash * @property {string} hash * @property {string=} resolved * @property {Set=} symlinks */ /** - * @typedef {Object} SnapshotOptimizationEntry + * @typedef {object} SnapshotOptimizationEntry * @property {Snapshot} snapshot * @property {number} shared * @property {Set | undefined} snapshotContent @@ -104,19 +104,19 @@ const INVALID = Symbol("invalid"); */ /** - * @typedef {Object} ResolveBuildDependenciesResult + * @typedef {object} ResolveBuildDependenciesResult * @property {Set} files list of files * @property {Set} directories list of directories * @property {Set} missing list of missing entries * @property {Map} resolveResults stored resolve results - * @property {Object} resolveDependencies dependencies of the resolving + * @property {object} resolveDependencies dependencies of the resolving * @property {Set} resolveDependencies.files list of files * @property {Set} resolveDependencies.directories list of directories * @property {Set} resolveDependencies.missing list of missing entries */ /** - * @typedef {Object} SnapshotOptions + * @typedef {object} SnapshotOptions * @property {boolean=} hash should use hash to snapshot * @property {boolean=} timestamp should use timestamp to snapshot */ @@ -918,7 +918,7 @@ const addAll = (source, target) => { class FileSystemInfo { /** * @param {InputFileSystem} fs file system - * @param {Object} options options + * @param {object} options options * @param {Iterable=} options.unmanagedPaths paths that are not managed by a package manager and the contents are subject to change * @param {Iterable=} options.managedPaths paths that are only managed by a package manager * @param {Iterable=} options.immutablePaths paths that are immutable @@ -3044,7 +3044,7 @@ class FileSystemInfo { /** * @template T * @template ItemType - * @param {Object} options options + * @param {object} options options * @param {string} options.path path * @param {function(string): ItemType} options.fromImmutablePath called when context item is an immutable path * @param {function(string): ItemType} options.fromManagedItem called when context item is a managed path @@ -3389,7 +3389,7 @@ class FileSystemInfo { : { ...timestamp, ...hash - }; + }; this._contextTshs.set(path, result); callback(null, result); }; diff --git a/lib/Generator.js b/lib/Generator.js index 2a272a64d62..8b7bbdbeecf 100644 --- a/lib/Generator.js +++ b/lib/Generator.js @@ -21,7 +21,7 @@ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} GenerateContext + * @typedef {object} GenerateContext * @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph @@ -35,7 +35,7 @@ */ /** - * @typedef {Object} UpdateHashContext + * @typedef {object} UpdateHashContext * @property {NormalModule} module the module * @property {ChunkGraph} chunkGraph * @property {RuntimeSpec} runtime diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 09911f0b877..5a8a13aebc4 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -57,7 +57,7 @@ const { /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} HMRJavascriptParserHooks + * @typedef {object} HMRJavascriptParserHooks * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptCallback * @property {SyncBailHook<[TODO, string[]], void>} hotAcceptWithoutCallback */ @@ -92,7 +92,7 @@ class HotModuleReplacementPlugin { } /** - * @param {Object=} options options + * @param {object=} options options */ constructor(options) { this.options = options || {}; @@ -500,7 +500,7 @@ class HotModuleReplacementPlugin { : compilation.codeGenerationResults.getHash( module, chunk.runtime - ); + ); if (records.chunkModuleHashes[key] !== hash) { updatedModules.add(module, chunk); } @@ -629,7 +629,7 @@ class HotModuleReplacementPlugin { : compilation.codeGenerationResults.getHash( module, newRuntime - ); + ); if (hash !== oldHash) { if (module.type === WEBPACK_MODULE_TYPE_RUNTIME) { newRuntimeModules = newRuntimeModules || []; @@ -798,7 +798,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/LibManifestPlugin.js b/lib/LibManifestPlugin.js index a718b6c86d2..79ebbee3698 100644 --- a/lib/LibManifestPlugin.js +++ b/lib/LibManifestPlugin.js @@ -16,14 +16,14 @@ const { dirname, mkdirp } = require("./util/fs"); /** @typedef {import("./Module").BuildMeta} BuildMeta */ /** - * @typedef {Object} ManifestModuleData + * @typedef {object} ManifestModuleData * @property {string | number} id * @property {BuildMeta} buildMeta * @property {boolean | string[] | undefined} exports */ /** - * @typedef {Object} LibManifestPluginOptions + * @typedef {object} LibManifestPluginOptions * @property {string=} context Context of requests in the manifest file (defaults to the webpack context). * @property {boolean=} entryOnly If true, only entry points will be exposed (default: true). * @property {boolean=} format If true, manifest json file (output) will be formatted. diff --git a/lib/Module.js b/lib/Module.js index c189391f0c5..0aec72a7345 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -45,7 +45,7 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} SourceContext + * @typedef {object} SourceContext * @property {DependencyTemplates} dependencyTemplates the dependency templates * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph @@ -56,7 +56,7 @@ const makeSerializable = require("./util/makeSerializable"); // TODO webpack 6: compilation will be required in CodeGenerationContext /** - * @typedef {Object} CodeGenerationContext + * @typedef {object} CodeGenerationContext * @property {DependencyTemplates} dependencyTemplates the dependency templates * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph @@ -69,7 +69,7 @@ const makeSerializable = require("./util/makeSerializable"); */ /** - * @typedef {Object} ConcatenationBailoutReasonContext + * @typedef {object} ConcatenationBailoutReasonContext * @property {ModuleGraph} moduleGraph the module graph * @property {ChunkGraph} chunkGraph the chunk graph */ @@ -78,7 +78,7 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {ReadonlySet} ReadOnlyRuntimeRequirements */ /** - * @typedef {Object} CodeGenerationResult + * @typedef {object} CodeGenerationResult * @property {Map} sources the resulting sources for all source types * @property {Map=} data the resulting data for all source types * @property {ReadOnlyRuntimeRequirements} runtimeRequirements the runtime requirements @@ -86,13 +86,13 @@ const makeSerializable = require("./util/makeSerializable"); */ /** - * @typedef {Object} LibIdentOptions + * @typedef {object} LibIdentOptions * @property {string} context absolute context path to which lib ident is relative to - * @property {Object=} associatedObjectForCache object for caching + * @property {object=} associatedObjectForCache object for caching */ /** - * @typedef {Object} KnownBuildMeta + * @typedef {object} KnownBuildMeta * @property {string=} moduleArgument * @property {string=} exportsArgument * @property {boolean=} strict @@ -105,7 +105,7 @@ const makeSerializable = require("./util/makeSerializable"); */ /** - * @typedef {Object} KnownBuildInfo + * @typedef {object} KnownBuildInfo * @property {boolean=} cacheable * @property {boolean=} parsed * @property {LazySet=} fileDependencies @@ -120,7 +120,7 @@ const makeSerializable = require("./util/makeSerializable"); */ /** - * @typedef {Object} NeedBuildContext + * @typedef {object} NeedBuildContext * @property {Compilation} compilation * @property {FileSystemInfo} fileSystemInfo * @property {Map>} valueCacheVersions @@ -130,7 +130,7 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {KnownBuildInfo & Record} BuildInfo */ /** - * @typedef {Object} FactoryMeta + * @typedef {object} FactoryMeta * @property {boolean=} sideEffectFree */ diff --git a/lib/ModuleFactory.js b/lib/ModuleFactory.js index 1d889c818b6..7b08be28be5 100644 --- a/lib/ModuleFactory.js +++ b/lib/ModuleFactory.js @@ -10,7 +10,7 @@ /** @typedef {import("./Module")} Module */ /** - * @typedef {Object} ModuleFactoryResult + * @typedef {object} ModuleFactoryResult * @property {Module=} module the created module or unset if no module was created * @property {Set=} fileDependencies * @property {Set=} contextDependencies @@ -19,14 +19,14 @@ */ /** - * @typedef {Object} ModuleFactoryCreateDataContextInfo + * @typedef {object} ModuleFactoryCreateDataContextInfo * @property {string} issuer * @property {string | null=} issuerLayer * @property {string} compiler */ /** - * @typedef {Object} ModuleFactoryCreateData + * @typedef {object} ModuleFactoryCreateData * @property {ModuleFactoryCreateDataContextInfo} contextInfo * @property {ResolveOptions=} resolveOptions * @property {string} context diff --git a/lib/ModuleFilenameHelpers.js b/lib/ModuleFilenameHelpers.js index 564cc2c5870..4165729b221 100644 --- a/lib/ModuleFilenameHelpers.js +++ b/lib/ModuleFilenameHelpers.js @@ -118,7 +118,7 @@ const asRegExp = test => { * Returns a lazy object. The object is lazy in the sense that the properties are * only evaluated when they are accessed. This is only obtained by setting a function as the value for each key. * @param {Record T>} obj the object to convert to a lazy access object - * @returns {Object} the lazy access object + * @returns {object} the lazy access object */ const lazyObject = obj => { const newObj = {}; @@ -146,7 +146,7 @@ const SQUARE_BRACKET_TAG_REGEXP = /\[\\*([\w-]+)\\*\]/gi; * * @param {Module | string} module the module * @param {TODO} options options - * @param {Object} contextInfo context info + * @param {object} contextInfo context info * @param {RequestShortener} contextInfo.requestShortener requestShortener * @param {ChunkGraph} contextInfo.chunkGraph chunk graph * @param {string | Hash=} contextInfo.hashFunction the hash function to use @@ -164,7 +164,7 @@ ModuleFilenameHelpers.createFilename = ( ? options : { moduleFilenameTemplate: options - }) + }) }; let absoluteResourcePath; diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index f9cc1e7f2ae..64e7daa7db5 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -132,7 +132,7 @@ class ModuleGraph { */ this._moduleMap = new Map(); /** - * @type {WeakMap} + * @type {WeakMap} * @private */ this._metaMap = new WeakMap(); @@ -757,20 +757,20 @@ class ModuleGraph { /** * @param {any} thing any thing - * @returns {Object} metadata + * @returns {object} metadata */ getMeta(thing) { let meta = this._metaMap.get(thing); if (meta === undefined) { meta = Object.create(null); - this._metaMap.set(thing, /** @type {Object} */ (meta)); + this._metaMap.set(thing, /** @type {object} */ (meta)); } - return /** @type {Object} */ (meta); + return /** @type {object} */ (meta); } /** * @param {any} thing any thing - * @returns {Object | undefined} metadata + * @returns {object | undefined} metadata */ getMetaIfExisting(thing) { return this._metaMap.get(thing); diff --git a/lib/MultiCompiler.js b/lib/MultiCompiler.js index be8bc1a3a6b..650fb31fa19 100644 --- a/lib/MultiCompiler.js +++ b/lib/MultiCompiler.js @@ -40,7 +40,7 @@ const ArrayQueue = require("./util/ArrayQueue"); */ /** - * @typedef {Object} MultiCompilerOptions + * @typedef {object} MultiCompilerOptions * @property {number=} parallelism how many Compilers are allows to run at the same time in parallel */ diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 1a780522810..ff0191be60f 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -89,7 +89,7 @@ const memoize = require("./util/memoize"); /** @typedef {UnsafeCacheData & { parser: undefined | Parser, parserOptions: undefined | ParserOptions, generator: undefined | Generator, generatorOptions: undefined | GeneratorOptions }} NormalModuleUnsafeCacheData */ /** - * @typedef {Object} SourceMap + * @typedef {object} SourceMap * @property {number} version * @property {string[]} sources * @property {string} mappings @@ -107,7 +107,7 @@ const getValidate = memoize(() => require("schema-utils").validate); const ABSOLUTE_PATH_REGEX = /^([a-zA-Z]:\\|\\\\|\/)/; /** - * @typedef {Object} LoaderItem + * @typedef {object} LoaderItem * @property {string} loader * @property {any} options * @property {string?} ident @@ -117,7 +117,7 @@ const ABSOLUTE_PATH_REGEX = /^([a-zA-Z]:\\|\\\\|\/)/; /** * @param {string} context absolute context path * @param {string} source a source path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} new source path */ const contextifySourceUrl = (context, source, associatedObjectForCache) => { @@ -132,7 +132,7 @@ const contextifySourceUrl = (context, source, associatedObjectForCache) => { /** * @param {string} context absolute context path * @param {SourceMap} sourceMap a source map - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {SourceMap} new source map */ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => { @@ -142,14 +142,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) ); @@ -199,7 +199,7 @@ makeSerializable( ); /** - * @typedef {Object} NormalModuleCompilationHooks + * @typedef {object} NormalModuleCompilationHooks * @property {SyncHook<[object, NormalModule]>} loader * @property {SyncHook<[LoaderItem[], NormalModule, object]>} beforeLoaders * @property {SyncHook<[NormalModule]>} beforeParse @@ -210,7 +210,7 @@ makeSerializable( */ /** - * @typedef {Object} NormalModuleCreateData + * @typedef {object} NormalModuleCreateData * @property {string=} layer an optional layer in which the module is * @property {JavaScriptModuleTypes | ""} type module type. When deserializing, this is set to an empty string "". * @property {string} request request string @@ -499,7 +499,7 @@ class NormalModule extends Module { * @param {string} name the asset name * @param {string | Buffer} content the content * @param {(string | SourceMap)=} sourceMap an optional source map - * @param {Object=} associatedObjectForCache object for caching + * @param {object=} associatedObjectForCache object for caching * @returns {Source} the created source */ createSourceForAsset( @@ -776,7 +776,7 @@ class NormalModule extends Module { * @param {string} context the compilation context * @param {string | Buffer} content the content * @param {(string | SourceMapSource)=} sourceMap an optional source map - * @param {Object=} associatedObjectForCache object for caching + * @param {object=} associatedObjectForCache object for caching * @returns {Source} the created source */ createSource(context, content, sourceMap, associatedObjectForCache) { @@ -859,7 +859,7 @@ class NormalModule extends Module { currentLoader ? compilation.runtimeTemplate.requestShortener.shorten( currentLoader.loader - ) + ) : "unknown" }) didn't return a Buffer or String` ); @@ -1156,10 +1156,10 @@ class NormalModule extends Module { if (absolute !== dep && ABSOLUTE_PATH_REGEX.test(absolute)) { (depWithoutGlob !== dep ? /** @type {NonNullable} */ - ( + ( /** @type {BuildInfo} */ (this.buildInfo) .contextDependencies - ) + ) : deps ).add(absolute); } @@ -1352,7 +1352,7 @@ class NormalModule extends Module { const source = this.error ? new RawSource( "throw new Error(" + JSON.stringify(this.error.message) + ");" - ) + ) : /** @type {Generator} */ (this.generator).generate(this, { dependencyTemplates, runtimeTemplate, @@ -1364,7 +1364,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 7bea83a793a..02ebf63e5c9 100644 --- a/lib/NormalModuleFactory.js +++ b/lib/NormalModuleFactory.js @@ -56,7 +56,7 @@ const { /** @typedef {Partial} CreateData */ /** - * @typedef {Object} ResolveData + * @typedef {object} ResolveData * @property {ModuleFactoryCreateData["contextInfo"]} contextInfo * @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions * @property {string} context @@ -72,7 +72,7 @@ const { */ /** - * @typedef {Object} ResourceData + * @typedef {object} ResourceData * @property {string} resource * @property {string=} path * @property {string=} query @@ -83,7 +83,7 @@ const { /** @typedef {ResourceData & { data: Record }} ResourceDataWithData */ /** - * @typedef {Object} ParsedLoaderRequest + * @typedef {object} ParsedLoaderRequest * @property {string} loader loader * @property {string|undefined} options options */ @@ -249,12 +249,12 @@ const ruleSetCompiler = new RuleSetCompiler([ class NormalModuleFactory extends ModuleFactory { /** - * @param {Object} param params + * @param {object} param params * @param {string=} param.context context * @param {InputFileSystem} param.fs file system * @param {ResolverFactory} param.resolverFactory resolverFactory * @param {ModuleOptions} param.options options - * @param {Object=} param.associatedObjectForCache an object to which the cache will be attached + * @param {object=} param.associatedObjectForCache an object to which the cache will be attached * @param {boolean=} param.layers enable layers */ constructor({ @@ -317,9 +317,9 @@ class NormalModuleFactory extends ModuleFactory { this.fs = fs; this._globalParserOptions = options.parser; this._globalGeneratorOptions = options.generator; - /** @type {Map>} */ + /** @type {Map>} */ this.parserCache = new Map(); - /** @type {Map>} */ + /** @type {Map>} */ this.generatorCache = new Map(); /** @type {Set} */ this._restoredUnsafeCacheEntries = new Set(); @@ -479,8 +479,8 @@ class NormalModuleFactory extends ModuleFactory { noPreAutoLoaders || noPrePostAutoLoaders ? 2 : noAutoLoaders - ? 1 - : 0 + ? 1 + : 0 ) .split(/!+/); unresolvedResource = /** @type {string} */ (rawElements.pop()); @@ -763,7 +763,7 @@ class NormalModuleFactory extends ModuleFactory { resolveOptions || EMPTY_RESOLVE_OPTIONS, "dependencyType", dependencyType - ) + ) : resolveOptions ); this.resolveResource( @@ -1178,12 +1178,12 @@ 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" - : /** @type {ResolveRequest} */ - (resolveRequest).descriptionFileData === undefined - ? undefined - : /** @type {ResolveRequest} */ - (resolveRequest).descriptionFileData.type; + ? "commonjs" + : /** @type {ResolveRequest} */ + (resolveRequest).descriptionFileData === undefined + ? undefined + : /** @type {ResolveRequest} */ + (resolveRequest).descriptionFileData.type; const resolved = { loader: parsedResult.path, type, diff --git a/lib/Parser.js b/lib/Parser.js index efd673d2b28..892c5fcd329 100644 --- a/lib/Parser.js +++ b/lib/Parser.js @@ -11,7 +11,7 @@ /** @typedef {Record} PreparsedAst */ /** - * @typedef {Object} ParserStateBase + * @typedef {object} ParserStateBase * @property {string | Buffer} source * @property {NormalModule} current * @property {NormalModule} module diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js index 4f551eaa080..bc7986e02c1 100644 --- a/lib/ProgressPlugin.js +++ b/lib/ProgressPlugin.js @@ -21,7 +21,7 @@ const { contextify } = require("./util/identifier"); /** @typedef {import("./logging/Logger").Logger} Logger */ /** - * @typedef {Object} CountsData + * @typedef {object} CountsData * @property {number} modulesCount modules count * @property {number} dependenciesCount dependencies count */ diff --git a/lib/RecordIdsPlugin.js b/lib/RecordIdsPlugin.js index c35028a7a7f..aaace61c89a 100644 --- a/lib/RecordIdsPlugin.js +++ b/lib/RecordIdsPlugin.js @@ -13,28 +13,28 @@ const identifierUtils = require("./util/identifier"); /** @typedef {import("./Module")} Module */ /** - * @typedef {Object} RecordsChunks + * @typedef {object} RecordsChunks * @property {Record=} byName * @property {Record=} bySource * @property {number[]=} usedIds */ /** - * @typedef {Object} RecordsModules + * @typedef {object} RecordsModules * @property {Record=} byIdentifier * @property {Record=} bySource * @property {number[]=} usedIds */ /** - * @typedef {Object} Records + * @typedef {object} Records * @property {RecordsChunks=} chunks * @property {RecordsModules=} modules */ class RecordIdsPlugin { /** - * @param {Object} options Options object + * @param {object} options Options object * @param {boolean=} options.portableIds true, when ids need to be portable */ constructor(options) { diff --git a/lib/ResolverFactory.js b/lib/ResolverFactory.js index 0296686b805..9651c6a73e8 100644 --- a/lib/ResolverFactory.js +++ b/lib/ResolverFactory.js @@ -22,7 +22,7 @@ const { /** @typedef {WebpackResolveOptions & {dependencyType?: string, resolveToContext?: boolean }} ResolveOptionsWithDependencyType */ /** - * @typedef {Object} WithOptions + * @typedef {object} WithOptions * @property {function(Partial): ResolverWithOptions} withOptions create a resolver with additional/different options */ @@ -68,8 +68,8 @@ const convertToResolveOptions = resolveOptionsWithDepType => { }; /** - * @typedef {Object} ResolverCache - * @property {WeakMap} direct + * @typedef {object} ResolverCache + * @property {WeakMap} direct * @property {Map} stringified */ diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index ebbb00dde98..bbd45921d60 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -271,7 +271,7 @@ class RuntimeTemplate { ? `var [${items.join(", ")}] = ${value};` : Template.asString( items.map((item, i) => `var ${item} = ${value}[${i}];`) - ); + ); } /** @@ -284,7 +284,7 @@ class RuntimeTemplate { ? `var {${items.join(", ")}} = ${value};` : Template.asString( items.map(item => `var ${item} = ${value}${propertyAccess([item])};`) - ); + ); } /** @@ -307,7 +307,7 @@ class RuntimeTemplate { ? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}` : `${array}.forEach(function(${variable}) {\n${Template.indent( body - )}\n});`; + )}\n});`; } /** @@ -394,7 +394,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {Module} options.module the module * @param {string=} options.request the request that should be printed as comment @@ -408,10 +408,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}); ` + @@ -431,7 +431,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {Module} options.module the module * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {string=} options.request the request that should be printed as comment @@ -460,7 +460,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {Module | null} options.module the module * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {string=} options.request the request that should be printed as comment @@ -503,7 +503,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {Module | null} options.module the module * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {string} options.request the request that should be printed as comment @@ -522,7 +522,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {Module} options.module the module * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {string} options.request the request that should be printed as comment @@ -591,7 +591,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {AsyncDependenciesBlock=} options.block the current dependencies block * @param {Module} options.module the module @@ -741,7 +741,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {RuntimeSpec=} options.runtime runtime for which this code will be generated * @param {RuntimeSpec | boolean=} options.runtimeCondition only execute the statement in some runtimes @@ -779,7 +779,7 @@ class RuntimeTemplate { /** * - * @param {Object} options options object + * @param {object} options options object * @param {boolean=} options.update whether a new variable should be created or the existing one updated * @param {Module} options.module the module * @param {ChunkGraph} options.chunkGraph the chunk graph @@ -856,7 +856,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options + * @param {object} options options * @param {ModuleGraph} options.moduleGraph the module graph * @param {Module} options.module the module * @param {string} options.request the request @@ -911,8 +911,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": @@ -969,8 +969,8 @@ class RuntimeTemplate { return asiSafe ? `(0,${access})` : asiSafe === false - ? `;(0,${access})` - : `/*#__PURE__*/Object(${access})`; + ? `;(0,${access})` + : `/*#__PURE__*/Object(${access})`; } return access; } else { @@ -979,7 +979,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options + * @param {object} options options * @param {AsyncDependenciesBlock | undefined} options.block the async block * @param {string} options.message the message * @param {ChunkGraph} options.chunkGraph the chunk graph @@ -1046,7 +1046,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options + * @param {object} options options * @param {AsyncDependenciesBlock} options.block the async block * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements @@ -1078,7 +1078,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options + * @param {object} options options * @param {Dependency} options.dependency the dependency * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements @@ -1099,7 +1099,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options + * @param {object} options options * @param {string} options.exportsArgument the name of the exports object * @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements * @returns {string} statement @@ -1111,7 +1111,7 @@ class RuntimeTemplate { } /** - * @param {Object} options options object + * @param {object} options options object * @param {Module} options.module the module * @param {RuntimeSpec=} options.runtime runtime * @param {CodeGenerationResults} options.codeGenerationResults the code generation results diff --git a/lib/Template.js b/lib/Template.js index e7a0203195b..4136cb343f4 100644 --- a/lib/Template.js +++ b/lib/Template.js @@ -41,7 +41,7 @@ const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g; const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; /** - * @typedef {Object} RenderManifestOptions + * @typedef {object} RenderManifestOptions * @property {Chunk} chunk the chunk used to render * @property {string} hash * @property {string} fullHash @@ -57,7 +57,7 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; /** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */ /** - * @typedef {Object} RenderManifestEntryTemplated + * @typedef {object} RenderManifestEntryTemplated * @property {function(): Source} render * @property {string | function(PathData, AssetInfo=): string} filenameTemplate * @property {PathData=} pathOptions @@ -68,7 +68,7 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; */ /** - * @typedef {Object} RenderManifestEntryStatic + * @typedef {object} RenderManifestEntryStatic * @property {function(): Source} render * @property {string} filename * @property {AssetInfo} info @@ -78,7 +78,7 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; */ /** - * @typedef {Object} HasId + * @typedef {object} HasId * @property {number | string} id */ @@ -252,7 +252,7 @@ class Template { } /** - * @typedef {Object} WithId + * @typedef {object} WithId * @property {string|number} id */ diff --git a/lib/buildChunkGraph.js b/lib/buildChunkGraph.js index 7e88762768b..f7400d41de7 100644 --- a/lib/buildChunkGraph.js +++ b/lib/buildChunkGraph.js @@ -25,7 +25,7 @@ const { getEntryRuntime, mergeRuntime } = require("./util/runtime"); /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} QueueItem + * @typedef {object} QueueItem * @property {number} action * @property {DependenciesBlock} block * @property {Module} module @@ -35,7 +35,7 @@ const { getEntryRuntime, mergeRuntime } = require("./util/runtime"); */ /** - * @typedef {Object} ChunkGroupInfo + * @typedef {object} ChunkGroupInfo * @property {ChunkGroup} chunkGroup the chunk group * @property {RuntimeSpec} runtime the runtimes * @property {bigint | undefined} minAvailableModules current minimal set of modules available at this point @@ -53,7 +53,7 @@ const { getEntryRuntime, mergeRuntime } = require("./util/runtime"); */ /** - * @typedef {Object} BlockChunkGroupConnection + * @typedef {object} BlockChunkGroupConnection * @property {ChunkGroupInfo} originChunkGroupInfo origin chunk group * @property {ChunkGroup} chunkGroup referenced chunk group */ diff --git a/lib/cache/MemoryWithGcCachePlugin.js b/lib/cache/MemoryWithGcCachePlugin.js index 96f72562f67..11cee616abf 100644 --- a/lib/cache/MemoryWithGcCachePlugin.js +++ b/lib/cache/MemoryWithGcCachePlugin.js @@ -14,7 +14,7 @@ const Cache = require("../Cache"); class MemoryWithGcCachePlugin { /** - * @param {Object} options Options + * @param {object} options Options * @param {number} options.maxGenerations max generations */ constructor({ maxGenerations }) { diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index 63695aa3aee..a40d38f5801 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -34,7 +34,7 @@ const { class PackContainer { /** - * @param {Object} data stored data + * @param {object} data stored data * @param {string} version version identifier * @param {Snapshot} buildSnapshot snapshot of all build dependencies * @param {BuildDependencies} buildDependencies list of all unresolved build dependencies captured @@ -556,7 +556,7 @@ class Pack { map.set(identifier, content.content.get(identifier)); } return new PackContentItems(map); - }) + }) : undefined; } } @@ -1027,7 +1027,7 @@ const allowCollectingMemory = buf => { class PackFileCacheStrategy { /** - * @param {Object} options options + * @param {object} options options * @param {Compiler} options.compiler the compiler * @param {IntermediateFileSystem} options.fs the filesystem * @param {string} options.context the context directory @@ -1079,8 +1079,8 @@ class PackFileCacheStrategy { compression === "brotli" ? ".pack.br" : compression === "gzip" - ? ".pack.gz" - : ".pack"; + ? ".pack.gz" + : ".pack"; this.snapshot = snapshot; /** @type {BuildDependencies} */ this.buildDependencies = new Set(); diff --git a/lib/cache/ResolverCachePlugin.js b/lib/cache/ResolverCachePlugin.js index 19004225604..0a567d66ac3 100644 --- a/lib/cache/ResolverCachePlugin.js +++ b/lib/cache/ResolverCachePlugin.js @@ -50,7 +50,7 @@ const addAllToSet = (set, otherSet) => { }; /** - * @param {Object} object an object + * @param {object} object an object * @param {boolean} excludeContext if true, context is not included in string * @returns {string} stringified version */ @@ -104,9 +104,9 @@ class ResolverCachePlugin { /** * @param {ItemCacheFacade} itemCache cache * @param {Resolver} resolver the resolver - * @param {Object} resolveContext context for resolving meta info - * @param {Object} request the request info object - * @param {function((Error | null)=, Object=): void} callback callback function + * @param {object} resolveContext context for resolving meta info + * @param {object} request the request info object + * @param {function((Error | null)=, object=): void} callback callback function * @returns {void} */ const doRealResolve = ( @@ -188,16 +188,16 @@ class ResolverCachePlugin { }; compiler.resolverFactory.hooks.resolver.intercept({ factory(type, hook) { - /** @type {Map} */ + /** @type {Map} */ const activeRequests = new Map(); - /** @type {Map} */ + /** @type {Map} */ const activeRequestsWithYield = new Map(); hook.tap( "ResolverCachePlugin", /** * @param {Resolver} resolver the resolver - * @param {Object} options resolve options - * @param {Object} userOptions resolve options passed by the user + * @param {object} options resolve options + * @param {object} userOptions resolve options passed by the user * @returns {void} */ (resolver, options, userOptions) => { @@ -269,7 +269,7 @@ class ResolverCachePlugin { yields = undefined; callbacks = false; } - } + } : (err, result) => { if (callbacks === undefined) { callback(err, result); @@ -281,7 +281,7 @@ class ResolverCachePlugin { activeRequests.delete(identifier); callbacks = false; } - }; + }; /** * @param {Error=} err error if any * @param {CacheEntry=} cacheEntry cache entry diff --git a/lib/cache/getLazyHashedEtag.js b/lib/cache/getLazyHashedEtag.js index 991009e3932..7fa918b4a19 100644 --- a/lib/cache/getLazyHashedEtag.js +++ b/lib/cache/getLazyHashedEtag.js @@ -11,7 +11,7 @@ const createHash = require("../util/createHash"); /** @typedef {typeof import("../util/Hash")} HashConstructor */ /** - * @typedef {Object} HashableObject + * @typedef {object} HashableObject * @property {function(Hash): void} updateHash */ diff --git a/lib/cli.js b/lib/cli.js index 7165b3ccc28..f8b43a5d783 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -10,7 +10,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json"); // TODO add originPath to PathItem for better errors /** - * @typedef {Object} PathItem + * @typedef {object} PathItem * @property {any} schema the part of the schema * @property {string} path the path in the config */ @@ -18,7 +18,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json"); /** @typedef {"unknown-argument" | "unexpected-non-array-in-path" | "unexpected-non-object-in-path" | "multiple-values-unexpected" | "invalid-value"} ProblemType */ /** - * @typedef {Object} Problem + * @typedef {object} Problem * @property {ProblemType} type * @property {string} path * @property {string} argument @@ -28,14 +28,14 @@ const webpackSchema = require("../schemas/WebpackOptions.json"); */ /** - * @typedef {Object} LocalProblem + * @typedef {object} LocalProblem * @property {ProblemType} type * @property {string} path * @property {string=} expected */ /** - * @typedef {Object} ArgumentConfig + * @typedef {object} ArgumentConfig * @property {string} description * @property {string} [negatedDescription] * @property {string} path @@ -45,7 +45,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json"); */ /** - * @typedef {Object} Argument + * @typedef {object} Argument * @property {string} description * @property {"string"|"number"|"boolean"} simpleType * @property {boolean} multiple diff --git a/lib/config/browserslistTargetHandler.js b/lib/config/browserslistTargetHandler.js index 0d278e9039e..f2e6b78400b 100644 --- a/lib/config/browserslistTargetHandler.js +++ b/lib/config/browserslistTargetHandler.js @@ -16,7 +16,7 @@ const path = require("path"); const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i; /** - * @typedef {Object} BrowserslistHandlerConfig + * @typedef {object} BrowserslistHandlerConfig * @property {string=} configPath * @property {string=} env * @property {string=} query diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 524f6b285a4..3b6c77bbe09 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -69,7 +69,7 @@ const { /** @typedef {import("./target").TargetProperties} TargetProperties */ /** - * @typedef {Object} ResolvedOptions + * @typedef {object} ResolvedOptions * @property {PlatformTargetProperties | false} platform - platform target properties */ @@ -346,7 +346,7 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => { /** * @param {ExperimentsNormalized} experiments options - * @param {Object} options options + * @param {object} options options * @param {boolean} options.production is production * @param {boolean} options.development is development mode * @param {TargetProperties | false} options.targetProperties target properties @@ -382,7 +382,7 @@ const applyExperimentsDefaults = ( /** * @param {CacheOptionsNormalized} cache options - * @param {Object} options options + * @param {object} options options * @param {string} options.name name * @param {Mode} options.mode mode * @param {boolean} options.development is development mode @@ -464,7 +464,7 @@ const applyCacheDefaults = ( /** * @param {SnapshotOptions} snapshot options - * @param {Object} options options + * @param {object} options options * @param {boolean} options.production is production * @param {boolean} options.futureDefaults is future defaults enabled * @returns {void} @@ -540,7 +540,7 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { /** * @param {JavascriptParserOptions} parserOptions parser options - * @param {Object} options options + * @param {object} options options * @param {boolean} options.futureDefaults is future defaults enabled * @param {boolean} options.isNode is node target platform * @returns {void} @@ -572,7 +572,7 @@ const applyJavascriptParserOptionsDefaults = ( /** * @param {CssGeneratorOptions} generatorOptions generator options - * @param {Object} options options + * @param {object} options options * @param {TargetProperties | false} options.targetProperties target properties * @returns {void} */ @@ -590,7 +590,7 @@ const applyCssGeneratorOptionsDefaults = ( /** * @param {ModuleOptions} module options - * @param {Object} options options + * @param {object} options options * @param {boolean} options.cache is caching enabled * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled * @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled @@ -850,7 +850,7 @@ const applyModuleDefaults = ( /** * @param {Output} output options - * @param {Object} options options + * @param {object} options options * @param {string} options.context context * @param {TargetProperties | false} options.targetProperties target properties * @param {boolean} options.isAffectedByBrowserslist is affected by browserslist @@ -1266,7 +1266,7 @@ const applyOutputDefaults = ( /** * @param {ExternalsPresets} externalsPresets options - * @param {Object} options options + * @param {object} options options * @param {TargetProperties | false} options.targetProperties target properties * @param {boolean} options.buildHttp buildHttp experiment enabled * @returns {void} @@ -1333,7 +1333,7 @@ const applyExternalsPresetsDefaults = ( /** * @param {Loader} loader options - * @param {Object} options options + * @param {object} options options * @param {TargetProperties | false} options.targetProperties target properties * @param {Environment} options.environment environment * @returns {void} @@ -1357,7 +1357,7 @@ const applyLoaderDefaults = (loader, { targetProperties, environment }) => { /** * @param {WebpackNode} node options - * @param {Object} options options + * @param {object} options options * @param {TargetProperties | false} options.targetProperties target properties * @param {boolean} options.futureDefaults is future defaults enabled * @param {boolean} options.outputModule is output type is module @@ -1388,7 +1388,7 @@ const applyNodeDefaults = ( /** * @param {Performance} performance options - * @param {Object} options options + * @param {object} options options * @param {boolean} options.production is production * @returns {void} */ @@ -1401,7 +1401,7 @@ const applyPerformanceDefaults = (performance, { production }) => { /** * @param {Optimization} optimization options - * @param {Object} options options + * @param {object} options options * @param {boolean} options.production is production * @param {boolean} options.development is development * @param {boolean} options.css is css enabled @@ -1493,7 +1493,7 @@ const applyOptimizationDefaults = ( }; /** - * @param {Object} options options + * @param {object} options options * @param {boolean} options.cache is cache enable * @param {string} options.context build context * @param {TargetProperties | false} options.targetProperties target properties @@ -1599,7 +1599,7 @@ const getResolveDefaults = ({ }; /** - * @param {Object} options options + * @param {object} options options * @param {boolean} options.cache is cache enable * @returns {ResolveOptions} resolve options */ diff --git a/lib/config/target.js b/lib/config/target.js index ea2fd6b6673..836d262d182 100644 --- a/lib/config/target.js +++ b/lib/config/target.js @@ -21,7 +21,7 @@ const getDefaultTarget = context => { }; /** - * @typedef {Object} PlatformTargetProperties + * @typedef {object} PlatformTargetProperties * @property {boolean | null} web web platform, importing of http(s) and std: is available * @property {boolean | null} browser browser platform, running in a normal web browser * @property {boolean | null} webworker (Web)Worker platform, running in a web/shared/service worker @@ -31,14 +31,14 @@ const getDefaultTarget = context => { */ /** - * @typedef {Object} ElectronContextTargetProperties + * @typedef {object} ElectronContextTargetProperties * @property {boolean | null} electronMain in main context * @property {boolean | null} electronPreload in preload context * @property {boolean | null} electronRenderer in renderer context with node integration */ /** - * @typedef {Object} ApiTargetProperties + * @typedef {object} ApiTargetProperties * @property {boolean | null} require has require function available * @property {boolean | null} nodeBuiltins has node.js built-in modules available * @property {boolean | null} nodePrefixForCoreModules node.js allows to use `node:` prefix for core modules @@ -50,7 +50,7 @@ const getDefaultTarget = context => { */ /** - * @typedef {Object} EcmaTargetProperties + * @typedef {object} EcmaTargetProperties * @property {boolean | null} globalThis has globalThis variable available * @property {boolean | null} bigIntLiteral big int literal syntax is available * @property {boolean | null} const const and let variable declarations are available @@ -348,7 +348,7 @@ const mergeTargetProperties = targetProperties => { keys.add(/** @type {keyof TargetProperties} */ (key)); } } - /** @type {Object} */ + /** @type {object} */ const result = {}; for (const key of keys) { let hasTrue = false; diff --git a/lib/container/ContainerEntryModule.js b/lib/container/ContainerEntryModule.js index 148c716afb9..3c13c7d160a 100644 --- a/lib/container/ContainerEntryModule.js +++ b/lib/container/ContainerEntryModule.js @@ -34,7 +34,7 @@ const ContainerExposedDependency = require("./ContainerExposedDependency"); /** @typedef {import("./ContainerEntryDependency")} ContainerEntryDependency */ /** - * @typedef {Object} ExposeOptions + * @typedef {object} ExposeOptions * @property {string[]} import requests to exposed modules (last one is exported) * @property {string} name custom chunk name for the exposed module */ diff --git a/lib/css/CssLoadingRuntimeModule.js b/lib/css/CssLoadingRuntimeModule.js index ee081d7737a..0b1a852c011 100644 --- a/lib/css/CssLoadingRuntimeModule.js +++ b/lib/css/CssLoadingRuntimeModule.js @@ -19,7 +19,7 @@ const { chunkHasCss } = require("./CssModulesPlugin"); /** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */ /** - * @typedef {Object} CssLoadingRuntimeModulePluginHooks + * @typedef {object} CssLoadingRuntimeModulePluginHooks * @property {SyncWaterfallHook<[string, Chunk]>} createStylesheet * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 2a1203107f3..706185d3de8 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -595,7 +595,7 @@ class CssModulesPlugin { } /** - * @param {Object} options options + * @param {object} options options * @param {string[]} options.metaData meta data * @param {string} options.undoPath undo path for public path auto * @param {Chunk} options.chunk chunk @@ -728,7 +728,7 @@ class CssModulesPlugin { } /** - * @param {Object} options options + * @param {object} options options * @param {string | undefined} options.uniqueName unique name * @param {boolean | undefined} options.cssHeadDataCompression compress css head data * @param {string} options.undoPath undo path for public path auto diff --git a/lib/css/walkCssTokens.js b/lib/css/walkCssTokens.js index badc61aa643..31285b5b56d 100644 --- a/lib/css/walkCssTokens.js +++ b/lib/css/walkCssTokens.js @@ -6,7 +6,7 @@ "use strict"; /** - * @typedef {Object} CssTokenCallbacks + * @typedef {object} CssTokenCallbacks * @property {function(string, number): boolean=} isSelector * @property {function(string, number, number, number, number): number=} url * @property {function(string, number, number): number=} string diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index 8c936716124..197f566c2d2 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -137,7 +137,7 @@ class Profiler { /** * an object that wraps Tracer and Profiler with a counter - * @typedef {Object} Trace + * @typedef {object} Trace * @property {Tracer} trace instance of Tracer * @property {number} counter Counter * @property {Profiler} profiler instance of Profiler diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index 937237c08d5..b9782bc5ebb 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -39,7 +39,7 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend const harmonySpecifierTag = Symbol("harmony import"); /** - * @typedef {Object} HarmonySettings + * @typedef {object} HarmonySettings * @property {string[]} ids * @property {string} source * @property {number} sourceOrder diff --git a/lib/dependencies/LoaderPlugin.js b/lib/dependencies/LoaderPlugin.js index f30c90c149a..dd24af0d947 100644 --- a/lib/dependencies/LoaderPlugin.js +++ b/lib/dependencies/LoaderPlugin.js @@ -29,7 +29,7 @@ const LoaderImportDependency = require("./LoaderImportDependency"); */ /** - * @typedef {Object} ImportModuleOptions + * @typedef {object} ImportModuleOptions * @property {string=} layer the target layer * @property {string=} publicPath the target public path * @property {string=} baseUri target base uri @@ -37,7 +37,7 @@ const LoaderImportDependency = require("./LoaderImportDependency"); class LoaderPlugin { /** - * @param {Object} options options + * @param {object} options options */ constructor(options = {}) {} diff --git a/lib/dependencies/WorkerDependency.js b/lib/dependencies/WorkerDependency.js index d96afadd9ae..16693d1a4cb 100644 --- a/lib/dependencies/WorkerDependency.js +++ b/lib/dependencies/WorkerDependency.js @@ -28,7 +28,7 @@ class WorkerDependency extends ModuleDependency { /** * @param {string} request request * @param {Range} range range - * @param {Object} workerDependencyOptions options + * @param {object} workerDependencyOptions options * @param {string=} workerDependencyOptions.publicPath public path for the worker */ constructor(request, range, workerDependencyOptions) { diff --git a/lib/esm/ModuleChunkLoadingRuntimeModule.js b/lib/esm/ModuleChunkLoadingRuntimeModule.js index 949e7daa7cf..f5f14755871 100644 --- a/lib/esm/ModuleChunkLoadingRuntimeModule.js +++ b/lib/esm/ModuleChunkLoadingRuntimeModule.js @@ -22,7 +22,7 @@ const { getUndoPath } = require("../util/identifier"); /** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */ /** - * @typedef {Object} JsonpCompilationPluginHooks + * @typedef {object} JsonpCompilationPluginHooks * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch */ diff --git a/lib/hmr/LazyCompilationPlugin.js b/lib/hmr/LazyCompilationPlugin.js index f92d69a44a3..3674c10d827 100644 --- a/lib/hmr/LazyCompilationPlugin.js +++ b/lib/hmr/LazyCompilationPlugin.js @@ -38,7 +38,7 @@ const { registerNotSerializable } = require("../util/serialization"); /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ /** - * @typedef {Object} BackendApi + * @typedef {object} BackendApi * @property {function(Error=): void} dispose * @property {function(Module): { client: string, data: string, active: boolean }} module */ @@ -319,7 +319,7 @@ class LazyCompilationDependencyFactory extends ModuleFactory { class LazyCompilationPlugin { /** - * @param {Object} options options + * @param {object} options options * @param {(function(Compiler, function(Error?, BackendApi?): void): void) | function(Compiler): Promise} options.backend the backend * @param {boolean} options.entries true, when entries are lazy compiled * @param {boolean} options.imports true, when import() modules are lazy compiled diff --git a/lib/ids/ChunkModuleIdRangePlugin.js b/lib/ids/ChunkModuleIdRangePlugin.js index 982ca1b1e66..280cce7531b 100644 --- a/lib/ids/ChunkModuleIdRangePlugin.js +++ b/lib/ids/ChunkModuleIdRangePlugin.js @@ -14,7 +14,7 @@ const { /** @typedef {import("../Compiler")} Compiler */ /** - * @typedef {Object} ChunkModuleIdRangePluginOptions + * @typedef {object} ChunkModuleIdRangePluginOptions * @property {string} name the chunk name * @property {("index" | "index2" | "preOrderIndex" | "postOrderIndex")=} order order * @property {number=} start start id diff --git a/lib/ids/DeterministicChunkIdsPlugin.js b/lib/ids/DeterministicChunkIdsPlugin.js index 4547400c45a..fbd8302cc6b 100644 --- a/lib/ids/DeterministicChunkIdsPlugin.js +++ b/lib/ids/DeterministicChunkIdsPlugin.js @@ -16,7 +16,7 @@ const { /** @typedef {import("../Module")} Module */ /** - * @typedef {Object} DeterministicChunkIdsPluginOptions + * @typedef {object} DeterministicChunkIdsPluginOptions * @property {string=} context context for ids * @property {number=} maxLength maximum length of ids */ diff --git a/lib/ids/DeterministicModuleIdsPlugin.js b/lib/ids/DeterministicModuleIdsPlugin.js index 0cfd973ae56..b4e33e6c3a2 100644 --- a/lib/ids/DeterministicModuleIdsPlugin.js +++ b/lib/ids/DeterministicModuleIdsPlugin.js @@ -18,7 +18,7 @@ const { /** @typedef {import("../Module")} Module */ /** - * @typedef {Object} DeterministicModuleIdsPluginOptions + * @typedef {object} DeterministicModuleIdsPluginOptions * @property {string=} context context relative to which module identifiers are computed * @property {function(Module): boolean=} test selector function for modules * @property {number=} maxLength maximum id length in digits (used as starting point) diff --git a/lib/ids/IdHelpers.js b/lib/ids/IdHelpers.js index 1ca7824ca96..0bf1c5dddf8 100644 --- a/lib/ids/IdHelpers.js +++ b/lib/ids/IdHelpers.js @@ -78,7 +78,7 @@ const shortenLongString = (string, delimiter, hashFunction) => { /** * @param {Module} module the module * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} short module name */ const getShortModuleName = (module, context, associatedObjectForCache) => { @@ -98,7 +98,7 @@ exports.getShortModuleName = getShortModuleName; * @param {Module} module the module * @param {string} context context directory * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} long module name */ const getLongModuleName = ( @@ -116,7 +116,7 @@ exports.getLongModuleName = getLongModuleName; /** * @param {Module} module the module * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} full module name */ const getFullModuleName = (module, context, associatedObjectForCache) => { @@ -134,7 +134,7 @@ exports.getFullModuleName = getFullModuleName; * @param {string} context context directory * @param {string} delimiter delimiter for names * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} short chunk name */ const getShortChunkName = ( @@ -164,7 +164,7 @@ exports.getShortChunkName = getShortChunkName; * @param {string} context context directory * @param {string} delimiter delimiter for names * @param {string | Hash} hashFunction hash function to use - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} short chunk name */ const getLongChunkName = ( @@ -197,7 +197,7 @@ exports.getLongChunkName = getLongChunkName; * @param {Chunk} chunk the chunk * @param {ChunkGraph} chunkGraph the chunk graph * @param {string} context context directory - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} full chunk name */ const getFullChunkName = ( diff --git a/lib/ids/NamedChunkIdsPlugin.js b/lib/ids/NamedChunkIdsPlugin.js index 6a668937343..f55a5875a7f 100644 --- a/lib/ids/NamedChunkIdsPlugin.js +++ b/lib/ids/NamedChunkIdsPlugin.js @@ -20,7 +20,7 @@ const { /** @typedef {import("../Module")} Module */ /** - * @typedef {Object} NamedChunkIdsPluginOptions + * @typedef {object} NamedChunkIdsPluginOptions * @property {string} [context] context * @property {string} [delimiter] delimiter */ diff --git a/lib/ids/NamedModuleIdsPlugin.js b/lib/ids/NamedModuleIdsPlugin.js index 7ae3c3d83ec..9656b8d917e 100644 --- a/lib/ids/NamedModuleIdsPlugin.js +++ b/lib/ids/NamedModuleIdsPlugin.js @@ -19,7 +19,7 @@ const { /** @typedef {import("../Module")} Module */ /** - * @typedef {Object} NamedModuleIdsPluginOptions + * @typedef {object} NamedModuleIdsPluginOptions * @property {string} [context] context */ diff --git a/lib/ids/SyncModuleIdsPlugin.js b/lib/ids/SyncModuleIdsPlugin.js index 2a94189d3ef..564ccc2f49f 100644 --- a/lib/ids/SyncModuleIdsPlugin.js +++ b/lib/ids/SyncModuleIdsPlugin.js @@ -15,7 +15,7 @@ const plugin = "SyncModuleIdsPlugin"; class SyncModuleIdsPlugin { /** - * @param {Object} options options + * @param {object} options options * @param {string} options.path path to file * @param {string=} options.context context for module names * @param {function(Module): boolean} options.test selector for modules @@ -63,7 +63,7 @@ class SyncModuleIdsPlugin { if (this._write) { compiler.hooks.emitRecords.tapAsync(plugin, callback => { if (!data || !dataChanged) return callback(); - /** @type {Object} */ + /** @type {{[key: string]: string | number}} */ const json = {}; const sorted = Array.from(data).sort(([a], [b]) => (a < b ? -1 : 1)); for (const [key, value] of sorted) { diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 9d557e6a555..163f438856e 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -89,7 +89,7 @@ const printGeneratedCodeForStack = (module, code) => { }; /** - * @typedef {Object} RenderContext + * @typedef {object} RenderContext * @property {Chunk} chunk the chunk * @property {DependencyTemplates} dependencyTemplates the dependency templates * @property {RuntimeTemplate} runtimeTemplate the runtime template @@ -100,7 +100,7 @@ const printGeneratedCodeForStack = (module, code) => { */ /** - * @typedef {Object} MainRenderContext + * @typedef {object} MainRenderContext * @property {Chunk} chunk the chunk * @property {DependencyTemplates} dependencyTemplates the dependency templates * @property {RuntimeTemplate} runtimeTemplate the runtime template @@ -112,7 +112,7 @@ const printGeneratedCodeForStack = (module, code) => { */ /** - * @typedef {Object} ChunkRenderContext + * @typedef {object} ChunkRenderContext * @property {Chunk} chunk the chunk * @property {DependencyTemplates} dependencyTemplates the dependency templates * @property {RuntimeTemplate} runtimeTemplate the runtime template @@ -124,7 +124,7 @@ const printGeneratedCodeForStack = (module, code) => { */ /** - * @typedef {Object} RenderBootstrapContext + * @typedef {object} RenderBootstrapContext * @property {Chunk} chunk the chunk * @property {CodeGenerationResults} codeGenerationResults results of code generation * @property {RuntimeTemplate} runtimeTemplate the runtime template @@ -136,7 +136,7 @@ const printGeneratedCodeForStack = (module, code) => { /** @typedef {RenderContext & { inlined: boolean }} StartupRenderContext */ /** - * @typedef {Object} CompilationHooks + * @typedef {object} CompilationHooks * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContent * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModuleContainer * @property {SyncWaterfallHook<[Source, Module, ChunkRenderContext]>} renderModulePackage diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index 9afa7b7afad..3a61898649a 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -129,14 +129,14 @@ class VariableInfo { /** @typedef {Omit & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */ /** - * @typedef {Object} TagInfo + * @typedef {object} TagInfo * @property {any} tag * @property {any} data * @property {TagInfo | undefined} next */ /** - * @typedef {Object} ScopeInfo + * @typedef {object} ScopeInfo * @property {StackedMap} definitions * @property {boolean | "arrow"} topLevelScope * @property {boolean | string} inShorthand @@ -149,7 +149,7 @@ class VariableInfo { /** @typedef {[number, number]} Range */ /** - * @typedef {Object} DestructuringAssignmentProperty + * @typedef {object} DestructuringAssignmentProperty * @property {string} id * @property {Range | undefined=} range * @property {boolean | string} shorthand @@ -613,7 +613,7 @@ class JavascriptParser extends Parser { * * import("./" + foo + bar); // webpack will auto evaluate this into import("./foobar") * ``` - * @param {boolean | number | BigInt | string} value the value to convert to an expression + * @param {boolean | number | bigint | string} value the value to convert to an expression * @param {BinaryExpression | UnaryExpression} expr the expression being evaluated * @param {boolean} sideEffects whether the expression has side effects * @returns {BasicEvaluatedExpression | undefined} the evaluated expression @@ -671,7 +671,7 @@ class JavascriptParser extends Parser { * Evaluates a binary expression if and only if it is a const operation (e.g. 1 + 2, "a" + "b", etc.). * * @template T - * @param {(leftOperand: T, rightOperand: T) => boolean | number | BigInt | string} operandHandler the handler for the operation (e.g. (a, b) => a + b) + * @param {(leftOperand: T, rightOperand: T) => boolean | number | bigint | string} operandHandler the handler for the operation (e.g. (a, b) => a + b) * @returns {BasicEvaluatedExpression | undefined} the evaluated expression */ const handleConstOperation = operandHandler => { @@ -1084,7 +1084,7 @@ class JavascriptParser extends Parser { * Evaluates a UnaryExpression if and only if it is a basic const operator (e.g. +a, -a, ~a). * * @template T - * @param {(operand: T) => boolean | number | BigInt | string} operandHandler handler for the operand + * @param {(operand: T) => boolean | number | bigint | string} operandHandler handler for the operand * @returns {BasicEvaluatedExpression | undefined} evaluated expression */ const handleConstOperation = operandHandler => { diff --git a/lib/library/AbstractLibraryPlugin.js b/lib/library/AbstractLibraryPlugin.js index c33441fbe54..fbd88a4bb82 100644 --- a/lib/library/AbstractLibraryPlugin.js +++ b/lib/library/AbstractLibraryPlugin.js @@ -26,7 +26,7 @@ const COMMON_LIBRARY_NAME_MESSAGE = /** * @template T - * @typedef {Object} LibraryContext + * @typedef {object} LibraryContext * @property {Compilation} compilation * @property {ChunkGraph} chunkGraph * @property {T} options @@ -37,7 +37,7 @@ const COMMON_LIBRARY_NAME_MESSAGE = */ class AbstractLibraryPlugin { /** - * @param {Object} options options + * @param {object} options options * @param {string} options.pluginName name of the plugin * @param {LibraryType} options.type used library type */ diff --git a/lib/library/AmdLibraryPlugin.js b/lib/library/AmdLibraryPlugin.js index 9cca2c9cb7f..29643ef2e46 100644 --- a/lib/library/AmdLibraryPlugin.js +++ b/lib/library/AmdLibraryPlugin.js @@ -21,13 +21,13 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); /** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ /** - * @typedef {Object} AmdLibraryPluginOptions + * @typedef {object} AmdLibraryPluginOptions * @property {LibraryType} type * @property {boolean=} requireAsWrapper */ /** - * @typedef {Object} AmdLibraryPluginParsed + * @typedef {object} AmdLibraryPluginParsed * @property {string} name * @property {string} amdContainer */ diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index b1657686a05..c3551c4acdb 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -91,7 +91,7 @@ const accessWithInit = (accessor, existingLength, initLast = false) => { }; /** - * @typedef {Object} AssignLibraryPluginOptions + * @typedef {object} AssignLibraryPluginOptions * @property {LibraryType} type * @property {string[] | "global"} prefix name prefix * @property {string | false} declare declare name as variable @@ -100,7 +100,7 @@ const accessWithInit = (accessor, existingLength, initLast = false) => { */ /** - * @typedef {Object} AssignLibraryPluginParsed + * @typedef {object} AssignLibraryPluginParsed * @property {string | string[]} name * @property {string | string[] | undefined} export */ @@ -323,7 +323,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin { true )};\n` ); - /** @type {String} */ + /** @type {string} */ let exports = RuntimeGlobals.exports; if (exportAccess) { result.add( diff --git a/lib/library/ExportPropertyLibraryPlugin.js b/lib/library/ExportPropertyLibraryPlugin.js index 48b720aca32..14c31c06990 100644 --- a/lib/library/ExportPropertyLibraryPlugin.js +++ b/lib/library/ExportPropertyLibraryPlugin.js @@ -22,12 +22,12 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); /** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ /** - * @typedef {Object} ExportPropertyLibraryPluginParsed + * @typedef {object} ExportPropertyLibraryPluginParsed * @property {string | string[]} export */ /** - * @typedef {Object} ExportPropertyLibraryPluginOptions + * @typedef {object} ExportPropertyLibraryPluginOptions * @property {LibraryType} type * @property {boolean} nsObjectUsed the namespace object is used */ diff --git a/lib/library/JsonpLibraryPlugin.js b/lib/library/JsonpLibraryPlugin.js index c9845f590c4..2c6cab0a37d 100644 --- a/lib/library/JsonpLibraryPlugin.js +++ b/lib/library/JsonpLibraryPlugin.js @@ -19,12 +19,12 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); /** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ /** - * @typedef {Object} JsonpLibraryPluginOptions + * @typedef {object} JsonpLibraryPluginOptions * @property {LibraryType} type */ /** - * @typedef {Object} JsonpLibraryPluginParsed + * @typedef {object} JsonpLibraryPluginParsed * @property {string} name */ diff --git a/lib/library/ModuleLibraryPlugin.js b/lib/library/ModuleLibraryPlugin.js index de05b184186..480014b0c80 100644 --- a/lib/library/ModuleLibraryPlugin.js +++ b/lib/library/ModuleLibraryPlugin.js @@ -23,12 +23,12 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); /** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ /** - * @typedef {Object} ModuleLibraryPluginOptions + * @typedef {object} ModuleLibraryPluginOptions * @property {LibraryType} type */ /** - * @typedef {Object} ModuleLibraryPluginParsed + * @typedef {object} ModuleLibraryPluginParsed * @property {string} name */ diff --git a/lib/library/SystemLibraryPlugin.js b/lib/library/SystemLibraryPlugin.js index 06fdabe34da..6a0df15bfff 100644 --- a/lib/library/SystemLibraryPlugin.js +++ b/lib/library/SystemLibraryPlugin.js @@ -23,12 +23,12 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); /** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext} LibraryContext */ /** - * @typedef {Object} SystemLibraryPluginOptions + * @typedef {object} SystemLibraryPluginOptions * @property {LibraryType} type */ /** - * @typedef {Object} SystemLibraryPluginParsed + * @typedef {object} SystemLibraryPluginParsed * @property {string} name */ diff --git a/lib/library/UmdLibraryPlugin.js b/lib/library/UmdLibraryPlugin.js index cd359fed206..5a61b91ed4b 100644 --- a/lib/library/UmdLibraryPlugin.js +++ b/lib/library/UmdLibraryPlugin.js @@ -58,13 +58,13 @@ const accessorAccess = (base, accessor, joinWith = ", ") => { /** @typedef {string | string[] | LibraryCustomUmdObject} UmdLibraryPluginName */ /** - * @typedef {Object} UmdLibraryPluginOptions + * @typedef {object} UmdLibraryPluginOptions * @property {LibraryType} type * @property {boolean=} optionalAmdExternalAsGlobal */ /** - * @typedef {Object} UmdLibraryPluginParsed + * @typedef {object} UmdLibraryPluginParsed * @property {string | string[]} name * @property {LibraryCustomUmdObject} names * @property {string | LibraryCustomUmdCommentObject} auxiliaryComment diff --git a/lib/logging/createConsoleLogger.js b/lib/logging/createConsoleLogger.js index 4cba9cf12ce..11ede889489 100644 --- a/lib/logging/createConsoleLogger.js +++ b/lib/logging/createConsoleLogger.js @@ -15,7 +15,7 @@ const { LogType } = require("./Logger"); /** @typedef {function(string, LogTypeEnum, any[]): void} LoggingFunction */ /** - * @typedef {Object} LoggerConsole + * @typedef {object} LoggerConsole * @property {function(): void} clear * @property {function(): void} trace * @property {(...args: any[]) => void} info @@ -33,7 +33,7 @@ const { LogType } = require("./Logger"); */ /** - * @typedef {Object} LoggerOptions + * @typedef {object} LoggerOptions * @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel * @property {FilterTypes|boolean} debug filter for debug logging * @property {LoggerConsole} console the console to log to diff --git a/lib/node/CommonJsChunkLoadingPlugin.js b/lib/node/CommonJsChunkLoadingPlugin.js index edf5d291746..cd7f787281a 100644 --- a/lib/node/CommonJsChunkLoadingPlugin.js +++ b/lib/node/CommonJsChunkLoadingPlugin.js @@ -12,7 +12,7 @@ const StartupChunkDependenciesPlugin = require("../runtime/StartupChunkDependenc /** @typedef {import("../Compiler")} Compiler */ /** - * @typedef {Object} CommonJsChunkLoadingPluginOptions + * @typedef {object} CommonJsChunkLoadingPluginOptions * @property {boolean} [asyncChunkLoading] enable async chunk loading */ diff --git a/lib/node/NodeEnvironmentPlugin.js b/lib/node/NodeEnvironmentPlugin.js index 0d297bd4862..221b1af0efa 100644 --- a/lib/node/NodeEnvironmentPlugin.js +++ b/lib/node/NodeEnvironmentPlugin.js @@ -17,7 +17,7 @@ const nodeConsole = require("./nodeConsole"); class NodeEnvironmentPlugin { /** - * @param {Object} options options + * @param {object} options options * @param {InfrastructureLogging} options.infrastructureLogging infrastructure logging options */ constructor(options) { diff --git a/lib/node/NodeTemplatePlugin.js b/lib/node/NodeTemplatePlugin.js index 1d7ea6048b5..c784368e373 100644 --- a/lib/node/NodeTemplatePlugin.js +++ b/lib/node/NodeTemplatePlugin.js @@ -11,7 +11,7 @@ const EnableChunkLoadingPlugin = require("../javascript/EnableChunkLoadingPlugin /** @typedef {import("../Compiler")} Compiler */ /** - * @typedef {Object} NodeTemplatePluginOptions + * @typedef {object} NodeTemplatePluginOptions * @property {boolean} [asyncChunkLoading] enable async chunk loading */ diff --git a/lib/node/ReadFileCompileWasmPlugin.js b/lib/node/ReadFileCompileWasmPlugin.js index 625b7da74c2..0a463994419 100644 --- a/lib/node/ReadFileCompileWasmPlugin.js +++ b/lib/node/ReadFileCompileWasmPlugin.js @@ -14,7 +14,7 @@ const WasmChunkLoadingRuntimeModule = require("../wasm-sync/WasmChunkLoadingRunt /** @typedef {import("../Compiler")} Compiler */ /** - * @typedef {Object} ReadFileCompileWasmPluginOptions + * @typedef {object} ReadFileCompileWasmPluginOptions * @property {boolean} [mangleImports] mangle imports */ diff --git a/lib/node/nodeConsole.js b/lib/node/nodeConsole.js index cccd02f0aaa..d4a50678b82 100644 --- a/lib/node/nodeConsole.js +++ b/lib/node/nodeConsole.js @@ -11,7 +11,7 @@ const truncateArgs = require("../logging/truncateArgs"); /** @typedef {import("../logging/createConsoleLogger").LoggerConsole} LoggerConsole */ /** - * @param {Object} options options + * @param {object} options options * @param {boolean=} options.colors colors * @param {boolean=} options.appendOnly append only * @param {NodeJS.WritableStream} options.stream stream diff --git a/lib/optimize/AggressiveMergingPlugin.js b/lib/optimize/AggressiveMergingPlugin.js index e6f24919d63..b86f8b690bf 100644 --- a/lib/optimize/AggressiveMergingPlugin.js +++ b/lib/optimize/AggressiveMergingPlugin.js @@ -11,7 +11,7 @@ const { STAGE_ADVANCED } = require("../OptimizationStages"); /** @typedef {import("../Compiler")} Compiler */ /** - * @typedef {Object} AggressiveMergingPluginOptions + * @typedef {object} AggressiveMergingPluginOptions * @property {number=} minSizeReduce minimal size reduction to trigger merging */ diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index d75a0367831..d938b12ed68 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -93,7 +93,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) { } /** - * @typedef {Object} ReexportInfo + * @typedef {object} ReexportInfo * @property {Module} module * @property {string[]} export */ @@ -101,7 +101,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) { /** @typedef {RawBinding | SymbolBinding} Binding */ /** - * @typedef {Object} RawBinding + * @typedef {object} RawBinding * @property {ModuleInfo} info * @property {string} rawName * @property {string=} comment @@ -110,7 +110,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) { */ /** - * @typedef {Object} SymbolBinding + * @typedef {object} SymbolBinding * @property {ConcatenatedModuleInfo} info * @property {string} name * @property {string=} comment @@ -122,7 +122,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) { /** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo } ModuleInfoOrReference */ /** - * @typedef {Object} ConcatenatedModuleInfo + * @typedef {object} ConcatenatedModuleInfo * @property {"concatenated"} type * @property {Module} module * @property {number} index @@ -147,7 +147,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) { */ /** - * @typedef {Object} ExternalModuleInfo + * @typedef {object} ExternalModuleInfo * @property {"external"} type * @property {Module} module * @property {RuntimeSpec | boolean} runtimeCondition @@ -162,7 +162,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) { */ /** - * @typedef {Object} ReferenceToModuleInfo + * @typedef {object} ReferenceToModuleInfo * @property {"reference"} type * @property {RuntimeSpec | boolean} runtimeCondition * @property {ConcatenatedModuleInfo | ExternalModuleInfo} target @@ -255,7 +255,7 @@ const joinIterableWithComma = iterable => { }; /** - * @typedef {Object} ConcatenationEntry + * @typedef {object} ConcatenationEntry * @property {"concatenated" | "external"} type * @property {Module} module * @property {RuntimeSpec | boolean} runtimeCondition @@ -633,7 +633,7 @@ class ConcatenatedModule extends Module { * @param {Module} rootModule the root module of the concatenation * @param {Set} modules all modules in the concatenation (including the root module) * @param {RuntimeSpec} runtime the runtime - * @param {Object=} associatedObjectForCache object for caching + * @param {object=} associatedObjectForCache object for caching * @param {string | HashConstructor=} hashFunction hash function to use * @returns {ConcatenatedModule} the module */ @@ -659,7 +659,7 @@ class ConcatenatedModule extends Module { } /** - * @param {Object} options options + * @param {object} options options * @param {string} options.identifier the identifier of the module * @param {Module=} options.rootModule the root module of the concatenation * @param {RuntimeSpec} options.runtime the selected runtime @@ -1033,7 +1033,7 @@ class ConcatenatedModule extends Module { /** * @param {Module} rootModule the root module of the concatenation * @param {Set} modules all modules in the concatenation (including the root module) - * @param {Object=} associatedObjectForCache object for caching + * @param {object=} associatedObjectForCache object for caching * @param {string | HashConstructor=} hashFunction hash function to use * @returns {string} the identifier */ diff --git a/lib/optimize/InnerGraph.js b/lib/optimize/InnerGraph.js index 7469eebbeb8..ab6877b48f5 100644 --- a/lib/optimize/InnerGraph.js +++ b/lib/optimize/InnerGraph.js @@ -21,7 +21,7 @@ const { UsageState } = require("../ExportsInfo"); /** @typedef {function(boolean | Set | undefined): void} UsageCallback */ /** - * @typedef {Object} StateObject + * @typedef {object} StateObject * @property {InnerGraph} innerGraph * @property {TopLevelSymbol=} currentTopLevelSymbol * @property {Map>} usageCallbackMap diff --git a/lib/optimize/LimitChunkCountPlugin.js b/lib/optimize/LimitChunkCountPlugin.js index fb88d70bd68..adf13db8a6a 100644 --- a/lib/optimize/LimitChunkCountPlugin.js +++ b/lib/optimize/LimitChunkCountPlugin.js @@ -24,7 +24,7 @@ const validate = createSchemaValidation( ); /** - * @typedef {Object} ChunkCombination + * @typedef {object} ChunkCombination * @property {boolean} deleted this is set to true when combination was removed * @property {number} sizeDiff * @property {number} integratedSize diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index bab6d16cfa1..282bebff6b0 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -28,7 +28,7 @@ const ConcatenatedModule = require("./ConcatenatedModule"); /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ /** - * @typedef {Object} Statistics + * @typedef {object} Statistics * @property {number} cached * @property {number} alreadyInConfig * @property {number} invalidModule diff --git a/lib/optimize/RealContentHashPlugin.js b/lib/optimize/RealContentHashPlugin.js index 8a50b5e1077..23a6abd88d6 100644 --- a/lib/optimize/RealContentHashPlugin.js +++ b/lib/optimize/RealContentHashPlugin.js @@ -87,7 +87,7 @@ const toCachedSource = source => { /** @typedef {Set} Hashes */ /** - * @typedef {Object} AssetInfoForRealContentHash + * @typedef {object} AssetInfoForRealContentHash * @property {string} name * @property {AssetInfo} info * @property {Source} source @@ -102,7 +102,7 @@ const toCachedSource = source => { */ /** - * @typedef {Object} CompilationHooks + * @typedef {object} CompilationHooks * @property {SyncBailHook<[Buffer[], string], string>} updateHash */ @@ -131,7 +131,7 @@ class RealContentHashPlugin { } /** - * @param {Object} options options object + * @param {object} options options object * @param {string | Hash} options.hashFunction the hash function to use * @param {string} options.hashDigest the hash digest to use */ diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index ab59c11f532..a898cb5c6a4 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -27,14 +27,14 @@ const formatLocation = require("../formatLocation"); /** @typedef {import("../javascript/JavascriptParser").Range} Range */ /** - * @typedef {Object} ExportInModule + * @typedef {object} ExportInModule * @property {Module} module the module * @property {string} exportName the name of the export * @property {boolean} checked if the export is conditional */ /** - * @typedef {Object} ReexportInfo + * @typedef {object} ReexportInfo * @property {Map} static * @property {Map>} dynamic */ diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index fec9c41ac02..122b4ef0453 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -52,7 +52,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning"); */ /** - * @typedef {Object} CacheGroupSource + * @typedef {object} CacheGroupSource * @property {string=} key * @property {number=} priority * @property {GetName=} getName @@ -75,7 +75,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning"); */ /** - * @typedef {Object} CacheGroup + * @typedef {object} CacheGroup * @property {string} key * @property {number=} priority * @property {GetName=} getName @@ -101,7 +101,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning"); */ /** - * @typedef {Object} FallbackCacheGroup + * @typedef {object} FallbackCacheGroup * @property {ChunkFilterFunction} chunksFilter * @property {SplitChunksSizes} minSize * @property {SplitChunksSizes} maxAsyncSize @@ -110,7 +110,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning"); */ /** - * @typedef {Object} CacheGroupsContext + * @typedef {object} CacheGroupsContext * @property {ModuleGraph} moduleGraph * @property {ChunkGraph} chunkGraph */ @@ -131,7 +131,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning"); */ /** - * @typedef {Object} SplitChunksOptions + * @typedef {object} SplitChunksOptions * @property {ChunkFilterFunction} chunksFilter * @property {string[]} defaultSizeTypes * @property {SplitChunksSizes} minSize @@ -153,7 +153,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning"); */ /** - * @typedef {Object} ChunksInfoItem + * @typedef {object} ChunksInfoItem * @property {SortableSet} modules * @property {CacheGroup} cacheGroup * @property {number} cacheGroupIndex @@ -1023,7 +1023,7 @@ module.exports = class SplitChunksPlugin { getExportsCombinationsFactory()(key); /** - * @typedef {Object} SelectedChunksResult + * @typedef {object} SelectedChunksResult * @property {Chunk[]} chunks the list of chunks * @property {bigint | Chunk} key a key of the list */ @@ -1322,7 +1322,7 @@ module.exports = class SplitChunksPlugin { } /** - * @typedef {Object} MaxSizeQueueItem + * @typedef {object} MaxSizeQueueItem * @property {SplitChunksSizes} minSize * @property {SplitChunksSizes} maxAsyncSize * @property {SplitChunksSizes} maxInitialSize diff --git a/lib/performance/SizeLimitsPlugin.js b/lib/performance/SizeLimitsPlugin.js index 7570c07d9d6..d41d0d3e042 100644 --- a/lib/performance/SizeLimitsPlugin.js +++ b/lib/performance/SizeLimitsPlugin.js @@ -19,13 +19,13 @@ const NoAsyncChunksWarning = require("./NoAsyncChunksWarning"); /** @typedef {import("../WebpackError")} WebpackError */ /** - * @typedef {Object} AssetDetails + * @typedef {object} AssetDetails * @property {string} name * @property {number} size */ /** - * @typedef {Object} EntrypointDetails + * @typedef {object} EntrypointDetails * @property {string} name * @property {number} size * @property {string[]} files diff --git a/lib/rules/RuleSetCompiler.js b/lib/rules/RuleSetCompiler.js index 4545c94cf2e..bf2ec76815c 100644 --- a/lib/rules/RuleSetCompiler.js +++ b/lib/rules/RuleSetCompiler.js @@ -10,20 +10,20 @@ const { SyncHook } = require("tapable"); /** @typedef {function(string): boolean} RuleConditionFunction */ /** - * @typedef {Object} RuleCondition + * @typedef {object} RuleCondition * @property {string | string[]} property * @property {boolean} matchWhenEmpty * @property {RuleConditionFunction} fn */ /** - * @typedef {Object} Condition + * @typedef {object} Condition * @property {boolean} matchWhenEmpty * @property {RuleConditionFunction} fn */ /** - * @typedef {Object} CompiledRule + * @typedef {object} CompiledRule * @property {RuleCondition[]} conditions * @property {(Effect|function(object): Effect[])[]} effects * @property {CompiledRule[]=} rules @@ -31,13 +31,13 @@ const { SyncHook } = require("tapable"); */ /** - * @typedef {Object} Effect + * @typedef {object} Effect * @property {string} type * @property {any} value */ /** - * @typedef {Object} RuleSet + * @typedef {object} RuleSet * @property {Map} references map of references in the rule set (may grow over time) * @property {function(object): Effect[]} exec execute the rule set */ diff --git a/lib/runtime/LoadScriptRuntimeModule.js b/lib/runtime/LoadScriptRuntimeModule.js index 9ed64dbd880..e8d05d62654 100644 --- a/lib/runtime/LoadScriptRuntimeModule.js +++ b/lib/runtime/LoadScriptRuntimeModule.js @@ -14,7 +14,7 @@ const HelperRuntimeModule = require("./HelperRuntimeModule"); /** @typedef {import("../Compiler")} Compiler */ /** - * @typedef {Object} LoadScriptCompilationHooks + * @typedef {object} LoadScriptCompilationHooks * @property {SyncWaterfallHook<[string, Chunk]>} createScript */ diff --git a/lib/runtime/StartupChunkDependenciesPlugin.js b/lib/runtime/StartupChunkDependenciesPlugin.js index 3704331a604..6fc74cde8ce 100644 --- a/lib/runtime/StartupChunkDependenciesPlugin.js +++ b/lib/runtime/StartupChunkDependenciesPlugin.js @@ -13,7 +13,7 @@ const StartupEntrypointRuntimeModule = require("./StartupEntrypointRuntimeModule /** @typedef {import("../Compiler")} Compiler */ /** - * @typedef {Object} Options + * @typedef {object} Options * @property {ChunkLoadingType} chunkLoading * @property {boolean=} asyncChunkLoading */ diff --git a/lib/schemes/HttpUriPlugin.js b/lib/schemes/HttpUriPlugin.js index 2922fe829ff..24f5ad226da 100644 --- a/lib/schemes/HttpUriPlugin.js +++ b/lib/schemes/HttpUriPlugin.js @@ -156,7 +156,7 @@ const parseCacheControl = (cacheControl, requestTime) => { }; /** - * @typedef {Object} LockfileEntry + * @typedef {object} LockfileEntry * @property {string} resolved * @property {string} integrity * @property {string} contentType diff --git a/lib/serialization/BinaryMiddleware.js b/lib/serialization/BinaryMiddleware.js index c2969b162cc..4074836aefe 100644 --- a/lib/serialization/BinaryMiddleware.js +++ b/lib/serialization/BinaryMiddleware.js @@ -143,7 +143,7 @@ const identifyBigInt = n => { class BinaryMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {SerializedType|Promise} serialized data */ serialize(data, context) { @@ -158,7 +158,7 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {Object} context context object + * @param {object} context context object * @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope * @returns {SerializedType} serialized data */ @@ -629,7 +629,7 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {DeserializedType|Promise} deserialized data */ deserialize(data, context) { @@ -653,7 +653,7 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {DeserializedType} deserialized data */ _deserialize(data, context) { diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index 505fd0efe84..0711b0d6e4b 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -81,7 +81,7 @@ const readUInt64LE = Buffer.prototype.readBigUInt64LE }; /** - * @typedef {Object} SerializeResult + * @typedef {object} SerializeResult * @property {string | false} name * @property {number} size * @property {Promise=} backgroundJob @@ -429,7 +429,7 @@ class FileMiddleware extends SerializerMiddleware { } /** * @param {DeserializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {SerializedType|Promise} serialized data */ serialize(data, context) { @@ -557,7 +557,7 @@ class FileMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {DeserializedType|Promise} deserialized data */ deserialize(data, context) { diff --git a/lib/serialization/NullPrototypeObjectSerializer.js b/lib/serialization/NullPrototypeObjectSerializer.js index f7263e335da..7877fb46578 100644 --- a/lib/serialization/NullPrototypeObjectSerializer.js +++ b/lib/serialization/NullPrototypeObjectSerializer.js @@ -9,7 +9,7 @@ class NullPrototypeObjectSerializer { /** - * @template {Object} T + * @template {object} T * @param {T} obj null object * @param {ObjectSerializerContext} context context */ @@ -25,7 +25,7 @@ class NullPrototypeObjectSerializer { } } /** - * @template {Object} T + * @template {object} T * @param {ObjectDeserializerContext} context context * @returns {T} null object */ diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index 6b300fd709b..81716919d82 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -44,7 +44,7 @@ Technically any value can be used. */ /** - * @typedef {Object} ObjectSerializerContext + * @typedef {object} ObjectSerializerContext * @property {function(any): void} write * @property {(function(any): void)=} writeLazy * @property {(function(any, object=): (() => Promise | any))=} writeSeparate @@ -52,13 +52,13 @@ Technically any value can be used. */ /** - * @typedef {Object} ObjectDeserializerContext + * @typedef {object} ObjectDeserializerContext * @property {function(): any} read * @property {function(any): void} setCircularReference */ /** - * @typedef {Object} ObjectSerializer + * @typedef {object} ObjectSerializer * @property {function(any, ObjectSerializerContext): void} serialize * @property {function(ObjectDeserializerContext): any} deserialize */ @@ -138,7 +138,7 @@ jsTypes.set(TypeError, new ErrorObjectSerializer(TypeError)); // real Object and Array types to. These types may occur in the wild too, e. g. when // using Structured Clone in postMessage. if (exports.constructor !== Object) { - const Obj = /** @type {typeof Object} */ (exports.constructor); + const Obj = /** @type {typeof object} */ (exports.constructor); const Fn = /** @type {typeof Function} */ (Obj.constructor); for (const [type, config] of Array.from(jsTypes)) { if (type) { @@ -289,7 +289,7 @@ class ObjectMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {SerializedType|Promise} serialized data */ serialize(data, context) { @@ -593,7 +593,7 @@ class ObjectMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {DeserializedType|Promise} deserialized data */ deserialize(data, context) { diff --git a/lib/serialization/PlainObjectSerializer.js b/lib/serialization/PlainObjectSerializer.js index b10ff5554e1..4bf5f04ce21 100644 --- a/lib/serialization/PlainObjectSerializer.js +++ b/lib/serialization/PlainObjectSerializer.js @@ -45,7 +45,7 @@ const getCachedKeys = (keys, cacheAssoc) => { class PlainObjectSerializer { /** - * @param {Object} obj plain object + * @param {object} obj plain object * @param {ObjectSerializerContext} context context */ serialize(obj, context) { @@ -72,7 +72,7 @@ class PlainObjectSerializer { } /** * @param {ObjectDeserializerContext} context context - * @returns {Object} plain object + * @returns {object} plain object */ deserialize(context) { const keys = context.read(); diff --git a/lib/serialization/SerializerMiddleware.js b/lib/serialization/SerializerMiddleware.js index 30d1d1ddd63..3a5ba283e9c 100644 --- a/lib/serialization/SerializerMiddleware.js +++ b/lib/serialization/SerializerMiddleware.js @@ -18,7 +18,7 @@ class SerializerMiddleware { /** * @abstract * @param {DeserializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {SerializedType|Promise} serialized data */ serialize(data, context) { @@ -30,7 +30,7 @@ class SerializerMiddleware { /** * @abstract * @param {SerializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {DeserializedType|Promise} deserialized data */ deserialize(data, context) { diff --git a/lib/serialization/SingleItemMiddleware.js b/lib/serialization/SingleItemMiddleware.js index bc9ea094026..faf95de6a17 100644 --- a/lib/serialization/SingleItemMiddleware.js +++ b/lib/serialization/SingleItemMiddleware.js @@ -14,7 +14,7 @@ const SerializerMiddleware = require("./SerializerMiddleware"); class SingleItemMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {SerializedType|Promise} serialized data */ serialize(data, context) { @@ -23,7 +23,7 @@ class SingleItemMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {Object} context context object + * @param {object} context context object * @returns {DeserializedType|Promise} deserialized data */ deserialize(data, context) { diff --git a/lib/serialization/types.js b/lib/serialization/types.js index 4d8f4ef181a..5f0cfdbc804 100644 --- a/lib/serialization/types.js +++ b/lib/serialization/types.js @@ -4,7 +4,7 @@ "use strict"; -/** @typedef {undefined|null|number|string|boolean|Buffer|Object|(() => ComplexSerializableType[] | Promise)} ComplexSerializableType */ +/** @typedef {undefined | null | number | string | boolean | Buffer | object | (() => ComplexSerializableType[] | Promise)} ComplexSerializableType */ /** @typedef {undefined|null|number|bigint|string|boolean|Buffer|(() => PrimitiveSerializableType[] | Promise)} PrimitiveSerializableType */ diff --git a/lib/sharing/ConsumeSharedModule.js b/lib/sharing/ConsumeSharedModule.js index 9dde23392c4..8ece29e21f2 100644 --- a/lib/sharing/ConsumeSharedModule.js +++ b/lib/sharing/ConsumeSharedModule.js @@ -36,7 +36,7 @@ const ConsumeSharedFallbackDependency = require("./ConsumeSharedFallbackDependen /** @typedef {import("../util/semver").SemVerRange} SemVerRange */ /** - * @typedef {Object} ConsumeOptions + * @typedef {object} ConsumeOptions * @property {string=} import fallback request * @property {string=} importResolved resolved fallback request * @property {string} shareKey global share key diff --git a/lib/sharing/ProvideSharedPlugin.js b/lib/sharing/ProvideSharedPlugin.js index 2debdcfca9f..9d9101dc6c3 100644 --- a/lib/sharing/ProvideSharedPlugin.js +++ b/lib/sharing/ProvideSharedPlugin.js @@ -27,7 +27,7 @@ const validate = createSchemaValidation( ); /** - * @typedef {Object} ProvideOptions + * @typedef {object} ProvideOptions * @property {string} shareKey * @property {string} shareScope * @property {string | undefined | false} version diff --git a/lib/sharing/resolveMatchedConfigs.js b/lib/sharing/resolveMatchedConfigs.js index 0639fdd82c1..30b406dd069 100644 --- a/lib/sharing/resolveMatchedConfigs.js +++ b/lib/sharing/resolveMatchedConfigs.js @@ -13,7 +13,7 @@ const LazySet = require("../util/LazySet"); /** * @template T - * @typedef {Object} MatchedConfigs + * @typedef {object} MatchedConfigs * @property {Map} resolved * @property {Map} unresolved * @property {Map} prefixed diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index 70f0998be86..ce4e00e3abb 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -48,7 +48,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsCompilation & Record} StatsCompilation */ /** - * @typedef {Object} KnownStatsCompilation + * @typedef {object} KnownStatsCompilation * @property {any=} env * @property {string=} name * @property {string=} hash @@ -76,7 +76,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsLogging & Record} StatsLogging */ /** - * @typedef {Object} KnownStatsLogging + * @typedef {object} KnownStatsLogging * @property {StatsLoggingEntry[]} entries * @property {number} filteredEntries * @property {boolean} debug @@ -84,7 +84,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsLoggingEntry & Record} StatsLoggingEntry */ /** - * @typedef {Object} KnownStatsLoggingEntry + * @typedef {object} KnownStatsLoggingEntry * @property {string} type * @property {string} message * @property {string[]=} trace @@ -95,7 +95,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsAsset & Record} StatsAsset */ /** - * @typedef {Object} KnownStatsAsset + * @typedef {object} KnownStatsAsset * @property {string} type * @property {string} name * @property {AssetInfo} info @@ -116,7 +116,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsChunkGroup & Record} StatsChunkGroup */ /** - * @typedef {Object} KnownStatsChunkGroup + * @typedef {object} KnownStatsChunkGroup * @property {string=} name * @property {(string|number)[]=} chunks * @property {({ name: string, size?: number })[]=} assets @@ -132,7 +132,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsModule & Record} StatsModule */ /** - * @typedef {Object} KnownStatsModule + * @typedef {object} KnownStatsModule * @property {string=} type * @property {string=} moduleType * @property {string=} layer @@ -176,7 +176,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsProfile & Record} StatsProfile */ /** - * @typedef {Object} KnownStatsProfile + * @typedef {object} KnownStatsProfile * @property {number} total * @property {number} resolving * @property {number} restoring @@ -191,7 +191,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsModuleIssuer & Record} StatsModuleIssuer */ /** - * @typedef {Object} KnownStatsModuleIssuer + * @typedef {object} KnownStatsModuleIssuer * @property {string=} identifier * @property {string=} name * @property {(string|number)=} id @@ -200,7 +200,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsModuleReason & Record} StatsModuleReason */ /** - * @typedef {Object} KnownStatsModuleReason + * @typedef {object} KnownStatsModuleReason * @property {string=} moduleIdentifier * @property {string=} module * @property {string=} moduleName @@ -217,7 +217,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsChunk & Record} StatsChunk */ /** - * @typedef {Object} KnownStatsChunk + * @typedef {object} KnownStatsChunk * @property {boolean} rendered * @property {boolean} initial * @property {boolean} entry @@ -243,7 +243,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsChunkOrigin & Record} StatsChunkOrigin */ /** - * @typedef {Object} KnownStatsChunkOrigin + * @typedef {object} KnownStatsChunkOrigin * @property {string=} module * @property {string=} moduleIdentifier * @property {string=} moduleName @@ -254,7 +254,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsModuleTraceItem & Record} StatsModuleTraceItem */ /** - * @typedef {Object} KnownStatsModuleTraceItem + * @typedef {object} KnownStatsModuleTraceItem * @property {string=} originIdentifier * @property {string=} originName * @property {string=} moduleIdentifier @@ -266,13 +266,13 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); /** @typedef {KnownStatsModuleTraceDependency & Record} StatsModuleTraceDependency */ /** - * @typedef {Object} KnownStatsModuleTraceDependency + * @typedef {object} KnownStatsModuleTraceDependency * @property {string=} loc */ /** @typedef {KnownStatsError & Record} StatsError */ /** - * @typedef {Object} KnownStatsError + * @typedef {object} KnownStatsError * @property {string} message * @property {string=} chunkName * @property {boolean=} chunkEntry @@ -297,7 +297,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier"); */ /** - * @typedef {Object} SimpleExtractors + * @typedef {object} SimpleExtractors * @property {ExtractorsByOption} compilation * @property {ExtractorsByOption} asset * @property {ExtractorsByOption} asset$visible @@ -1526,7 +1526,7 @@ const FILTER = { } }; -/** @type {Record boolean | undefined>>} */ +/** @type {Record boolean | undefined>>} */ const FILTER_RESULTS = { "compilation.warnings": { warningsFilter: util.deprecate( @@ -2246,7 +2246,7 @@ const sortOrderRegular = field => { /** * @param {string} field field name - * @returns {function(Object, Object): number} comparators + * @returns {function(object, object): number} comparators */ const sortByField = field => { if (!field) { @@ -2361,8 +2361,8 @@ const ITEM_NAMES = { }; /** - * @param {Object[]} items items to be merged - * @returns {Object} an object + * @param {object[]} items items to be merged + * @returns {object} an object */ const mergeToObject = items => { const obj = Object.create(null); @@ -2372,7 +2372,7 @@ const mergeToObject = items => { return obj; }; -/** @type {Record any>} */ +/** @type {Record any>} */ const MERGER = { "compilation.entrypoints": mergeToObject, "compilation.namedChunkGroups": mergeToObject diff --git a/lib/stats/DefaultStatsPrinterPlugin.js b/lib/stats/DefaultStatsPrinterPlugin.js index 7821075ae6f..89d57c5732a 100644 --- a/lib/stats/DefaultStatsPrinterPlugin.js +++ b/lib/stats/DefaultStatsPrinterPlugin.js @@ -22,7 +22,7 @@ const plural = (n, singular, plural) => (n === 1 ? singular : plural); /** * @param {Record} sizes sizes by source type - * @param {Object} options options + * @param {object} options options * @param {(number) => string=} options.formatSize size formatter * @returns {string} text */ diff --git a/lib/stats/StatsFactory.js b/lib/stats/StatsFactory.js index 4ba7063bd3e..c3a3f5d1807 100644 --- a/lib/stats/StatsFactory.js +++ b/lib/stats/StatsFactory.js @@ -18,7 +18,7 @@ const smartGrouping = require("../util/smartGrouping"); /** @typedef {import("../util/smartGrouping").GroupConfig} GroupConfig */ /** - * @typedef {Object} KnownStatsFactoryContext + * @typedef {object} KnownStatsFactoryContext * @property {string} type * @property {function(string): string=} makePathsRelative * @property {Compilation=} compilation @@ -35,7 +35,7 @@ const smartGrouping = require("../util/smartGrouping"); class StatsFactory { constructor() { this.hooks = Object.freeze({ - /** @type {HookMap>} */ + /** @type {HookMap>} */ extract: new HookMap( () => new SyncBailHook(["object", "data", "context"]) ), diff --git a/lib/stats/StatsPrinter.js b/lib/stats/StatsPrinter.js index 228b81db485..e28166d5ebf 100644 --- a/lib/stats/StatsPrinter.js +++ b/lib/stats/StatsPrinter.js @@ -17,13 +17,13 @@ const { HookMap, SyncWaterfallHook, SyncBailHook } = require("tapable"); /** @typedef {import("./DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */ /** - * @typedef {Object} PrintedElement + * @typedef {object} PrintedElement * @property {string} element * @property {string} content */ /** - * @typedef {Object} KnownStatsPrinterContext + * @typedef {object} KnownStatsPrinterContext * @property {string=} type * @property {StatsCompilation=} compilation * @property {StatsChunkGroup=} chunkGroup @@ -147,8 +147,8 @@ class StatsPrinter { /** * @param {string} type The type - * @param {Object} object Object to print - * @param {Object=} baseContext The base context + * @param {object} object Object to print + * @param {object=} baseContext The base context * @returns {string} printed result */ print(type, object, baseContext) { @@ -168,8 +168,8 @@ class StatsPrinter { /** * @private * @param {string} type type - * @param {Object} object object - * @param {Object=} baseContext context + * @param {object} object object + * @param {object=} baseContext context * @returns {string} printed result */ _print(type, object, baseContext) { diff --git a/lib/util/AsyncQueue.js b/lib/util/AsyncQueue.js index feb69a7d5d1..f7834d0a9e3 100644 --- a/lib/util/AsyncQueue.js +++ b/lib/util/AsyncQueue.js @@ -53,7 +53,7 @@ class AsyncQueueEntry { */ class AsyncQueue { /** - * @param {Object} options options object + * @param {object} options options object * @param {string=} options.name name of the queue * @param {number=} options.parallelism how many items should be processed at once * @param {AsyncQueue=} options.parent parent queue, which will have priority over this queue and with shared parallelism diff --git a/lib/util/binarySearchBounds.js b/lib/util/binarySearchBounds.js index af04daa1718..355624c60e6 100644 --- a/lib/util/binarySearchBounds.js +++ b/lib/util/binarySearchBounds.js @@ -75,7 +75,7 @@ const compileSearch = (funcName, predicate, reversed, extraArgs, earlyOut) => { * @param {boolean} reversed Whether the search should be reversed. * @param {SearchPredicateSuffix} suffix The suffix to be used in the function name. * @param {boolean=} earlyOut Whether the search should return as soon as a match is found. - * @returns {function} The compiled binary search function. + * @returns {Function} The compiled binary search function. */ const compileBoundsSearch = (predicate, reversed, suffix, earlyOut) => { const arg1 = compileSearch( diff --git a/lib/util/cleverMerge.js b/lib/util/cleverMerge.js index a430435f088..3825bf80630 100644 --- a/lib/util/cleverMerge.js +++ b/lib/util/cleverMerge.js @@ -81,14 +81,14 @@ const cachedSetProperty = (obj, property, value) => { }; /** - * @typedef {Object} ObjectParsedPropertyEntry + * @typedef {object} ObjectParsedPropertyEntry * @property {any | undefined} base base value * @property {string | undefined} byProperty the name of the selector property * @property {Map} byValues value depending on selector property, merged with base */ /** - * @typedef {Object} ParsedObject + * @typedef {object} ParsedObject * @property {Map} static static properties (key is property name) * @property {{ byProperty: string, fn: Function } | undefined} dynamic dynamic part */ @@ -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/createHash.js b/lib/util/createHash.js index 3cf5a27b7fb..0732f81d1cb 100644 --- a/lib/util/createHash.js +++ b/lib/util/createHash.js @@ -11,7 +11,7 @@ const BULK_SIZE = 2000; // We are using an object instead of a Map as this will stay static during the runtime // so access to it can be optimized by v8 -/** @type {Object>} */ +/** @type {{[key: string]: Map}} */ const digestCaches = {}; /** @typedef {function(): Hash} HashFactory */ diff --git a/lib/util/deprecation.js b/lib/util/deprecation.js index 35298d74077..a64a94b6396 100644 --- a/lib/util/deprecation.js +++ b/lib/util/deprecation.js @@ -11,7 +11,7 @@ const util = require("util"); const deprecationCache = new Map(); /** - * @typedef {Object} FakeHookMarker + * @typedef {object} FakeHookMarker * @property {true} _fakeHook it's a fake hook */ @@ -187,11 +187,11 @@ exports.createArrayToSetDeprecationSet = name => { /** * @template T - * @param {Object} obj object + * @param {object} obj object * @param {string} name property name * @param {string} code deprecation code * @param {string} note additional note - * @returns {Object} frozen object with deprecation when modifying + * @returns {object} frozen object with deprecation when modifying */ exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => { const message = `${name} will be frozen in future, all modifications are deprecated.${ diff --git a/lib/util/deterministicGrouping.js b/lib/util/deterministicGrouping.js index 97f266b58e6..7d72e5bbf55 100644 --- a/lib/util/deterministicGrouping.js +++ b/lib/util/deterministicGrouping.js @@ -272,7 +272,7 @@ const getSimilarities = nodes => { /** * @template T - * @typedef {Object} GroupedItems + * @typedef {object} GroupedItems * @property {string} key * @property {T[]} items * @property {Record} size @@ -280,7 +280,7 @@ const getSimilarities = nodes => { /** * @template T - * @typedef {Object} Options + * @typedef {object} Options * @property {Record} maxSize maximum size of a group * @property {Record} minSize minimum size of a group (preferred over maximum size) * @property {Iterable} items a list of items diff --git a/lib/util/findGraphRoots.js b/lib/util/findGraphRoots.js index 4e3c1cb2722..f70b860e778 100644 --- a/lib/util/findGraphRoots.js +++ b/lib/util/findGraphRoots.js @@ -41,7 +41,7 @@ class Cycle { /** * @template T - * @typedef {Object} StackEntry + * @typedef {object} StackEntry * @property {Node} node * @property {Node[]} openEdges */ diff --git a/lib/util/fs.js b/lib/util/fs.js index 4b1697c3dde..5403d8b8d02 100644 --- a/lib/util/fs.js +++ b/lib/util/fs.js @@ -12,7 +12,7 @@ const path = require("path"); /** * @template T - * @typedef {Object} IStatsBase + * @typedef {object} IStatsBase * @property {() => boolean} isFile * @property {() => boolean} isDirectory * @property {() => boolean} isBlockDevice @@ -49,7 +49,7 @@ const path = require("path"); */ /** - * @typedef {Object} Dirent + * @typedef {object} Dirent * @property {() => boolean} isFile * @property {() => boolean} isDirectory * @property {() => boolean} isBlockDevice @@ -81,7 +81,7 @@ const path = require("path"); /** @typedef {function(NodeJS.ErrnoException | Error | null, JsonObject=): void} ReadJsonCallback */ /** - * @typedef {Object} WatcherInfo + * @typedef {object} WatcherInfo * @property {Set} changes get current aggregated changes that have not yet send to callback * @property {Set} removals get current aggregated removals that have not yet send to callback * @property {Map} fileTimeInfoEntries get info about files @@ -90,7 +90,7 @@ const path = require("path"); // TODO webpack 6 deprecate missing getInfo /** - * @typedef {Object} Watcher + * @typedef {object} Watcher * @property {function(): void} close closes the watcher and all underlying file watchers * @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call * @property {function(): Set=} getAggregatedChanges get current aggregated changes that have not yet send to callback @@ -123,7 +123,7 @@ const path = require("path"); */ /** - * @typedef {Object} ObjectEncodingOptions + * @typedef {object} ObjectEncodingOptions * @property {BufferEncoding | null | undefined} [encoding] */ @@ -153,12 +153,12 @@ const path = require("path"); */ /** - * @typedef {Object} StatOptions + * @typedef {object} StatOptions * @property {(boolean | undefined)=} bigint */ /** - * @typedef {Object} StatSyncOptions + * @typedef {object} StatSyncOptions * @property {(boolean | undefined)=} bigint * @property {(boolean | undefined)=} throwIfNoEntry */ @@ -271,7 +271,7 @@ const path = require("path"); */ /** - * @typedef {Object} InputFileSystem + * @typedef {object} InputFileSystem * @property {ReadFile} readFile * @property {ReadFileSync=} readFileSync * @property {Readlink} readlink @@ -336,7 +336,7 @@ const path = require("path"); */ /** - * @typedef {Object} OutputFileSystem + * @typedef {object} OutputFileSystem * @property {WriteFile} writeFile * @property {Mkdir} mkdir * @property {Readdir=} readdir @@ -351,7 +351,7 @@ const path = require("path"); */ /** - * @typedef {Object} WatchFileSystem + * @typedef {object} WatchFileSystem * @property {WatchMethod} watch */ @@ -364,7 +364,7 @@ const path = require("path"); */ /** - * @typedef {Object} StreamOptions + * @typedef {object} StreamOptions * @property {(string | undefined)=} flags * @property {(BufferEncoding | undefined)} encoding * @property {(number | any | undefined)=} fd @@ -376,7 +376,7 @@ const path = require("path"); */ /** - * @typedef {Object} FSImplementation + * @typedef {object} FSImplementation * @property {((...args: any[]) => any)=} open * @property {((...args: any[]) => any)=} close */ @@ -410,7 +410,7 @@ const path = require("path"); */ /** - * @typedef {Object} ReadSyncOptions + * @typedef {object} ReadSyncOptions * @property {(number | undefined)=} offset * @property {(number | undefined)=} length * @property {(ReadPosition | null | undefined)=} position @@ -418,7 +418,7 @@ const path = require("path"); /** * @template {NodeJS.ArrayBufferView} TBuffer - * @typedef {Object} ReadAsyncOptions + * @typedef {object} ReadAsyncOptions * @property {(number | undefined)=} offset * @property {(number | undefined)=} length * @property {(ReadPosition | null | undefined)=} position @@ -439,7 +439,7 @@ const path = require("path"); /** @typedef {function(PathLike, PathLike, NoParamCallback): void} Rename */ /** - * @typedef {Object} IntermediateFileSystemExtras + * @typedef {object} IntermediateFileSystemExtras * @property {MkdirSync} mkdirSync * @property {CreateWriteStream} createWriteStream * @property {Open} open diff --git a/lib/util/identifier.js b/lib/util/identifier.js index 659988163be..5cde5e43d76 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -11,7 +11,7 @@ const SEGMENTS_SPLIT_REGEXP = /([|!])/; const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g; /** - * @typedef {Object} MakeRelativePathsCache + * @typedef {object} MakeRelativePathsCache * @property {Map>=} relativePaths */ @@ -100,7 +100,7 @@ const makeCacheable = realFn => { /** * @param {string} str the path with query and fragment - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {ParsedResource} parsed parts */ const fn = (str, associatedObjectForCache) => { @@ -134,7 +134,7 @@ const makeCacheableWithContext = fn => { /** * @param {string} context context used to create relative path * @param {string} identifier identifier used to create relative path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {string} the returned relative path */ const cachedFn = (context, identifier, associatedObjectForCache) => { @@ -164,7 +164,7 @@ const makeCacheableWithContext = fn => { }; /** - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {function(string, string): string} cached function */ cachedFn.bindCache = associatedObjectForCache => { @@ -207,7 +207,7 @@ const makeCacheableWithContext = fn => { /** * @param {string} context context used to create relative path - * @param {Object=} associatedObjectForCache an object to which the cache will be attached + * @param {object=} associatedObjectForCache an object to which the cache will be attached * @returns {function(string): string} cached function */ cachedFn.bindContextCache = (context, associatedObjectForCache) => { @@ -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/smartGrouping.js b/lib/util/smartGrouping.js index 01d1d4bec8e..dcaf8100a8a 100644 --- a/lib/util/smartGrouping.js +++ b/lib/util/smartGrouping.js @@ -6,7 +6,7 @@ "use strict"; /** - * @typedef {Object} GroupOptions + * @typedef {object} GroupOptions * @property {boolean=} groupChildren * @property {boolean=} force * @property {number=} targetGroupCount @@ -15,7 +15,7 @@ /** * @template T * @template R - * @typedef {Object} GroupConfig + * @typedef {object} GroupConfig * @property {function(T): string[]} getKeys * @property {function(string, (R | T)[], T[]): R} createGroup * @property {function(string, T[]): GroupOptions=} getOptions @@ -24,7 +24,7 @@ /** * @template T * @template R - * @typedef {Object} ItemWithGroups + * @typedef {object} ItemWithGroups * @property {T} item * @property {Set>} groups */ @@ -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 4f8c673e1b0..1730f3d2ac3 100644 --- a/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +++ b/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js @@ -13,7 +13,7 @@ const Template = require("../Template"); /** @typedef {import("../Compilation")} Compilation */ /** - * @typedef {Object} AsyncWasmLoadingRuntimeModuleOptions + * @typedef {object} AsyncWasmLoadingRuntimeModuleOptions * @property {function(string): string} generateLoadBinaryCode * @property {boolean} supportsStreaming */ @@ -69,7 +69,9 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule { const concat = (/** @type {string[]} */ ...text) => text.join(""); return [ `var req = ${loader};`, - `var fallback = ${runtimeTemplate.returningFunction(Template.asString(["req", Template.indent(fallback)]))};`, + `var fallback = ${runtimeTemplate.returningFunction( + Template.asString(["req", Template.indent(fallback)]) + )};`, concat( "return req.then(", runtimeTemplate.basicFunction("res", [ diff --git a/lib/wasm-async/AsyncWebAssemblyGenerator.js b/lib/wasm-async/AsyncWebAssemblyGenerator.js index 7a43f26375b..b29e8a00fb6 100644 --- a/lib/wasm-async/AsyncWebAssemblyGenerator.js +++ b/lib/wasm-async/AsyncWebAssemblyGenerator.js @@ -14,7 +14,7 @@ const Generator = require("../Generator"); const TYPES = new Set(["webassembly"]); /** - * @typedef {Object} AsyncWebAssemblyGeneratorOptions + * @typedef {object} AsyncWebAssemblyGeneratorOptions * @property {boolean} [mangleImports] mangle imports */ diff --git a/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js b/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js index cd93468e954..6da3c93dfe2 100644 --- a/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +++ b/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js @@ -39,7 +39,7 @@ const getAsyncWebAssemblyParser = memoize(() => ); /** - * @typedef {Object} WebAssemblyRenderContext + * @typedef {object} WebAssemblyRenderContext * @property {Chunk} chunk the chunk * @property {DependencyTemplates} dependencyTemplates the dependency templates * @property {RuntimeTemplate} runtimeTemplate the runtime template @@ -49,12 +49,12 @@ const getAsyncWebAssemblyParser = memoize(() => */ /** - * @typedef {Object} CompilationHooks + * @typedef {object} CompilationHooks * @property {SyncWaterfallHook<[Source, Module, WebAssemblyRenderContext]>} renderModuleContent */ /** - * @typedef {Object} AsyncWebAssemblyModulesPluginOptions + * @typedef {object} AsyncWebAssemblyModulesPluginOptions * @property {boolean} [mangleImports] mangle imports */ diff --git a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js index 755aec2b896..1e99b6e08eb 100644 --- a/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +++ b/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js @@ -210,7 +210,7 @@ const generateImportObject = ( }; /** - * @typedef {Object} WasmChunkLoadingRuntimeModuleOptions + * @typedef {object} WasmChunkLoadingRuntimeModuleOptions * @property {(path: string) => string} generateLoadBinaryCode * @property {boolean} [supportsStreaming] * @property {boolean} [mangleImports] @@ -363,7 +363,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { "importObject" )});` ]) - ]) + ]) : Template.asString([ "if(importObject && typeof importObject.then === 'function') {", Template.indent([ @@ -381,7 +381,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule { ]), "});" ]) - ]), + ]), "} else {", Template.indent([ "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", diff --git a/lib/wasm-sync/WebAssemblyGenerator.js b/lib/wasm-sync/WebAssemblyGenerator.js index fbfb94e5e3b..645e1f95193 100644 --- a/lib/wasm-sync/WebAssemblyGenerator.js +++ b/lib/wasm-sync/WebAssemblyGenerator.js @@ -55,8 +55,8 @@ const compose = (...fns) => { /** * Removes the start instruction * - * @param {Object} state state - * @param {Object} state.ast Module's ast + * @param {object} state state + * @param {object} state.ast Module's ast * @returns {ArrayBufferTransform} transform */ const removeStartFunc = state => bin => { @@ -70,7 +70,7 @@ const removeStartFunc = state => bin => { /** * Get imported globals * - * @param {Object} ast Module's AST + * @param {object} ast Module's AST * @returns {t.ModuleImport[]} - nodes */ const getImportedGlobals = ast => { @@ -91,8 +91,8 @@ const getImportedGlobals = ast => { /** * Get the count for imported func * - * @param {Object} ast Module's AST - * @returns {Number} - count + * @param {object} ast Module's AST + * @returns {number} - count */ const getCountImportedFunc = ast => { let count = 0; @@ -111,7 +111,7 @@ const getCountImportedFunc = ast => { /** * Get next type index * - * @param {Object} ast Module's AST + * @param {object} ast Module's AST * @returns {t.Index} - index */ const getNextTypeIndex = ast => { @@ -131,8 +131,8 @@ const getNextTypeIndex = ast => { * in order to have the correct index we shift the index by number of external * functions. * - * @param {Object} ast Module's AST - * @param {Number} countImportedFunc number of imported funcs + * @param {object} ast Module's AST + * @param {number} countImportedFunc number of imported funcs * @returns {t.Index} - index */ const getNextFuncIndex = (ast, countImportedFunc) => { @@ -178,8 +178,8 @@ const createDefaultInitForGlobal = globalType => { * * Note that globals will become mutable. * - * @param {Object} state transformation state - * @param {Object} state.ast Module's ast + * @param {object} state transformation state + * @param {object} state.ast Module's ast * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function * @returns {ArrayBufferTransform} transform */ @@ -248,8 +248,8 @@ const rewriteImportedGlobals = state => bin => { /** * Rewrite the export names - * @param {Object} state state - * @param {Object} state.ast Module's ast + * @param {object} state state + * @param {object} state.ast Module's ast * @param {Module} state.module Module * @param {ModuleGraph} state.moduleGraph module graph * @param {Set} state.externalExports Module @@ -283,8 +283,8 @@ const rewriteExportNames = /** * Mangle import names and modules - * @param {Object} state state - * @param {Object} state.ast Module's ast + * @param {object} state state + * @param {object} state.ast Module's ast * @param {Map} state.usedDependencyMap mappings to mangle names * @returns {ArrayBufferTransform} transform */ @@ -313,8 +313,8 @@ const rewriteImports = * * The init function fills the globals given input arguments. * - * @param {Object} state transformation state - * @param {Object} state.ast Module's ast + * @param {object} state transformation state + * @param {object} state.ast Module's ast * @param {t.Identifier} state.initFuncId identifier of the init function * @param {t.Index} state.startAtFuncOffset index of the start function * @param {t.ModuleImport[]} state.importedGlobals list of imported globals @@ -418,7 +418,7 @@ const getUsedDependencyMap = (moduleGraph, module, mangle) => { const TYPES = new Set(["webassembly"]); /** - * @typedef {Object} WebAssemblyGeneratorOptions + * @typedef {object} WebAssemblyGeneratorOptions * @property {boolean} [mangleImports] mangle imports */ diff --git a/lib/wasm-sync/WebAssemblyModulesPlugin.js b/lib/wasm-sync/WebAssemblyModulesPlugin.js index ad31aa4daa5..dc3ff32ef5f 100644 --- a/lib/wasm-sync/WebAssemblyModulesPlugin.js +++ b/lib/wasm-sync/WebAssemblyModulesPlugin.js @@ -31,7 +31,7 @@ const getWebAssemblyParser = memoize(() => require("./WebAssemblyParser")); const PLUGIN_NAME = "WebAssemblyModulesPlugin"; /** - * @typedef {Object} WebAssemblyModulesPluginOptions + * @typedef {object} WebAssemblyModulesPluginOptions * @property {boolean} [mangleImports] mangle imports */ diff --git a/lib/wasm-sync/WebAssemblyUtils.js b/lib/wasm-sync/WebAssemblyUtils.js index 0e984af5a0d..a73cd748408 100644 --- a/lib/wasm-sync/WebAssemblyUtils.js +++ b/lib/wasm-sync/WebAssemblyUtils.js @@ -12,7 +12,7 @@ const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDe /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** - * @typedef {Object} UsedWasmDependency + * @typedef {object} UsedWasmDependency * @property {WebAssemblyImportDependency} dependency the dependency * @property {string} name the export name * @property {string} module the module name diff --git a/lib/web/FetchCompileWasmPlugin.js b/lib/web/FetchCompileWasmPlugin.js index 3bc99ee1bd9..8acb9a71186 100644 --- a/lib/web/FetchCompileWasmPlugin.js +++ b/lib/web/FetchCompileWasmPlugin.js @@ -17,7 +17,7 @@ const WasmChunkLoadingRuntimeModule = require("../wasm-sync/WasmChunkLoadingRunt const PLUGIN_NAME = "FetchCompileWasmPlugin"; /** - * @typedef {Object} FetchCompileWasmPluginOptions + * @typedef {object} FetchCompileWasmPluginOptions * @property {boolean} [mangleImports] mangle imports */ diff --git a/lib/web/JsonpChunkLoadingRuntimeModule.js b/lib/web/JsonpChunkLoadingRuntimeModule.js index 2df2b411502..34eaf5b19bb 100644 --- a/lib/web/JsonpChunkLoadingRuntimeModule.js +++ b/lib/web/JsonpChunkLoadingRuntimeModule.js @@ -18,7 +18,7 @@ const compileBooleanMatcher = require("../util/compileBooleanMatcher"); /** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */ /** - * @typedef {Object} JsonpCompilationPluginHooks + * @typedef {object} JsonpCompilationPluginHooks * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch */ @@ -210,16 +210,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) && ${ @@ -233,7 +233,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { crossOriginLoading ? `link.crossOrigin = ${JSON.stringify( crossOriginLoading - )};` + )};` : "", `if (${RuntimeGlobals.scriptNonce}) {`, Template.indent( @@ -249,13 +249,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) && ${ @@ -291,7 +291,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { )};` ), "}" - ]) + ]) : "" ]), chunk @@ -299,7 +299,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { "document.head.appendChild(link);" ]), "}" - ])};` + ])};` : "// no preloaded", "", withHmr @@ -384,7 +384,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule { /\$hmrInvalidateModuleHandlers\$/g, RuntimeGlobals.hmrInvalidateModuleHandlers ) - ]) + ]) : "// no HMR", "", withHmrManifest @@ -401,16 +401,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 @@ -462,7 +462,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" ]); }