diff --git a/lib/CompatibilityPlugin.js b/lib/CompatibilityPlugin.js index 46ddd7e80..05cdeece6 100644 --- a/lib/CompatibilityPlugin.js +++ b/lib/CompatibilityPlugin.js @@ -18,6 +18,7 @@ const ConstDependency = require("./dependencies/ConstDependency"); /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ /** @typedef {import("./javascript/JavascriptParser").Range} Range */ +/** @typedef {import("./javascript/JavascriptParser").TagData} TagData */ const nestedWebpackIdentifierTag = Symbol("nested webpack identifier"); const PLUGIN_NAME = "CompatibilityPlugin"; @@ -145,7 +146,9 @@ class CompatibilityPlugin { parser.hooks.expression .for(nestedWebpackIdentifierTag) .tap(PLUGIN_NAME, expr => { - const { name, declaration } = parser.currentTagData; + const { name, declaration } = + /** @type {TagData} */ + (parser.currentTagData); if (!declaration.updated) { const dep = new ConstDependency(name, declaration.range); dep.loc = declaration.loc; diff --git a/lib/Compilation.js b/lib/Compilation.js index b10c62d81..2ce701656 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -1039,6 +1039,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * @type {Map} */ this._modules = new Map(); + /** @type {Record | null} */ this.records = null; /** @type {string[]} */ this.additionalChunkAssets = []; @@ -1064,9 +1065,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si ); /** @type {Record} */ this.childrenCounters = {}; - /** @type {Set} */ + /** @type {Set | null} */ this.usedChunkIds = null; - /** @type {Set} */ + /** @type {Set | null} */ this.usedModuleIds = null; /** @type {boolean} */ this.needAdditionalPass = false; @@ -2084,7 +2085,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si contextInfo: { issuer: originModule ? originModule.nameForCondition() : "", issuerLayer: originModule ? originModule.layer : null, - compiler: this.compiler.name, + compiler: /** @type {string} */ (this.compiler.name), ...contextInfo }, resolveOptions: originModule ? originModule.resolveOptions : undefined, @@ -3752,7 +3753,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o groupOptions = { name: groupOptions }; } const name = groupOptions.name; - if (name) { const chunkGroup = this.namedChunkGroups.get(name); if (chunkGroup !== undefined) { diff --git a/lib/DynamicEntryPlugin.js b/lib/DynamicEntryPlugin.js index 5e185fbee..428bd58bf 100644 --- a/lib/DynamicEntryPlugin.js +++ b/lib/DynamicEntryPlugin.js @@ -58,7 +58,7 @@ class DynamicEntryPlugin { promises.push( new Promise( /** - * @param {(value?: any) => void} resolve resolve + * @param {(value?: undefined) => void} resolve resolve * @param {(reason?: Error) => void} reject reject */ (resolve, reject) => { diff --git a/lib/buildChunkGraph.js b/lib/buildChunkGraph.js index ce2dafebb..d179fc03a 100644 --- a/lib/buildChunkGraph.js +++ b/lib/buildChunkGraph.js @@ -508,7 +508,9 @@ const visitModules = ( cgi = { chunkGroup: entrypoint, initialized: false, - runtime: entrypoint.options.runtime || entrypoint.name, + runtime: + entrypoint.options.runtime || + /** @type {string | undefined} */ (entrypoint.name), minAvailableModules: ZERO_BIGINT, availableModulesToBeMerged: [], skippedItems: undefined, @@ -527,11 +529,19 @@ const visitModules = ( ? entryOptions.asyncChunks : chunkGroupInfo.asyncChunks }; - chunkGroupInfoMap.set(entrypoint, cgi); + chunkGroupInfoMap.set( + entrypoint, + /** @type {ChunkGroupInfo} */ + (cgi) + ); chunkGraph.connectBlockAndChunkGroup(b, entrypoint); if (chunkName) { - namedAsyncEntrypoints.set(chunkName, cgi); + namedAsyncEntrypoints.set( + chunkName, + /** @type {ChunkGroupInfo} */ + (cgi) + ); } } else { entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup); @@ -551,7 +561,7 @@ const visitModules = ( module, chunk: entrypoint.chunks[0], chunkGroup: entrypoint, - chunkGroupInfo: cgi + chunkGroupInfo: /** @type {ChunkGroupInfo} */ (cgi) }); } else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) { // Just queue the block into the current chunk group diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index df8958879..e7fee666f 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -25,6 +25,7 @@ const { /** @typedef {import("../logging/Logger").Logger} Logger */ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ +/** @typedef {typeof import("../util/Hash")} Hash */ /** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ /** @typedef {Map} ResolveResults */ @@ -1093,7 +1094,8 @@ class PackFileCacheStrategy { }) { this.fileSerializer = createFileSerializer( fs, - compiler.options.output.hashFunction + /** @type {string | Hash} */ + (compiler.options.output.hashFunction) ); this.fileSystemInfo = new FileSystemInfo(fs, { managedPaths: snapshot.managedPaths, diff --git a/lib/config/defaults.js b/lib/config/defaults.js index ae92bdfb0..e0d2c03eb 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -261,7 +261,7 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => { (options.experiments.css), futureDefaults, isNode: targetProperties && targetProperties.node === true, - uniqueName: options.output.uniqueName, + uniqueName: /** @type {string} */ (options.output.uniqueName), targetProperties, mode: options.mode }); @@ -610,7 +610,7 @@ const applyCssGeneratorOptionsDefaults = ( * @param {string} options.uniqueName the unique name * @param {boolean} options.isNode is node target platform * @param {TargetProperties | false} options.targetProperties target properties - * @param {Mode} options.mode mode + * @param {Mode | undefined} options.mode mode * @returns {void} */ const applyModuleDefaults = ( @@ -646,19 +646,19 @@ const applyModuleDefaults = ( F(module.parser, ASSET_MODULE_TYPE, () => ({})); F( - /** @type {NonNullable} */ + /** @type {NonNullable} */ (module.parser[ASSET_MODULE_TYPE]), "dataUrlCondition", () => ({}) ); if ( typeof ( - /** @type {NonNullable} */ + /** @type {NonNullable} */ (module.parser[ASSET_MODULE_TYPE]).dataUrlCondition ) === "object" ) { D( - /** @type {NonNullable} */ + /** @type {NonNullable} */ (module.parser[ASSET_MODULE_TYPE]).dataUrlCondition, "maxSize", 8096 @@ -685,14 +685,29 @@ const applyModuleDefaults = ( if (css) { F(module.parser, CSS_MODULE_TYPE, () => ({})); - D(module.parser[CSS_MODULE_TYPE], "import", true); - D(module.parser[CSS_MODULE_TYPE], "url", true); - D(module.parser[CSS_MODULE_TYPE], "namedExports", true); + D( + /** @type {NonNullable} */ + (module.parser[CSS_MODULE_TYPE]), + "import", + true + ); + D( + /** @type {NonNullable} */ + (module.parser[CSS_MODULE_TYPE]), + "url", + true + ); + D( + /** @type {NonNullable} */ + (module.parser[CSS_MODULE_TYPE]), + "namedExports", + true + ); F(module.generator, CSS_MODULE_TYPE, () => ({})); applyCssGeneratorOptionsDefaults( - /** @type {NonNullable} */ + /** @type {NonNullable} */ (module.generator[CSS_MODULE_TYPE]), { targetProperties } ); @@ -701,24 +716,46 @@ const applyModuleDefaults = ( uniqueName.length > 0 ? "[uniqueName]-[id]-[local]" : "[id]-[local]"; F(module.generator, CSS_MODULE_TYPE_AUTO, () => ({})); - D(module.generator[CSS_MODULE_TYPE_AUTO], "localIdentName", localIdentName); - D(module.generator[CSS_MODULE_TYPE_AUTO], "exportsConvention", "as-is"); + D( + /** @type {NonNullable} */ + (module.generator[CSS_MODULE_TYPE_AUTO]), + "localIdentName", + localIdentName + ); + D( + /** @type {NonNullable} */ + (module.generator[CSS_MODULE_TYPE_AUTO]), + "exportsConvention", + "as-is" + ); F(module.generator, CSS_MODULE_TYPE_MODULE, () => ({})); D( - module.generator[CSS_MODULE_TYPE_MODULE], + /** @type {NonNullable} */ + (module.generator[CSS_MODULE_TYPE_MODULE]), "localIdentName", localIdentName ); - D(module.generator[CSS_MODULE_TYPE_MODULE], "exportsConvention", "as-is"); + D( + /** @type {NonNullable} */ + (module.generator[CSS_MODULE_TYPE_MODULE]), + "exportsConvention", + "as-is" + ); F(module.generator, CSS_MODULE_TYPE_GLOBAL, () => ({})); D( - module.generator[CSS_MODULE_TYPE_GLOBAL], + /** @type {NonNullable} */ + (module.generator[CSS_MODULE_TYPE_GLOBAL]), "localIdentName", localIdentName ); - D(module.generator[CSS_MODULE_TYPE_GLOBAL], "exportsConvention", "as-is"); + D( + /** @type {NonNullable} */ + (module.generator[CSS_MODULE_TYPE_GLOBAL]), + "exportsConvention", + "as-is" + ); } A(module, "defaultRules", () => { @@ -1486,7 +1523,7 @@ const applyOptimizationDefaults = ( passes: 2 } } - }).apply(compiler); + }).apply(/** @type {TODO} */ (compiler)); } } ]); diff --git a/lib/css/CssGenerator.js b/lib/css/CssGenerator.js index 4efdc73c4..a6f1d45ce 100644 --- a/lib/css/CssGenerator.js +++ b/lib/css/CssGenerator.js @@ -26,6 +26,7 @@ const Template = require("../Template"); /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../Generator").GenerateContext} GenerateContext */ /** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ +/** @typedef {import("../Module").BuildInfo} BuildInfo */ /** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */ /** @typedef {import("../Module").SourceTypes} SourceTypes */ /** @typedef {import("../NormalModule")} NormalModule */ @@ -131,7 +132,8 @@ class CssGenerator extends Generator { switch (generateContext.type) { case "javascript": { - module.buildInfo.cssData = cssData; + /** @type {BuildInfo} */ + (module.buildInfo).cssData = cssData; generateContext.runtimeRequirements.add(RuntimeGlobals.module); @@ -203,6 +205,8 @@ class CssGenerator extends Generator { return InitFragment.addToSource(source, initFragments, generateContext); } + default: + return null; } } @@ -223,11 +227,12 @@ class CssGenerator extends Generator { getSize(module, type) { switch (type) { case "javascript": { - if (!module.buildInfo.cssData) { + const buildInfo = /** @type {BuildInfo} */ (module.buildInfo); + if (!buildInfo.cssData) { return 42; } - const exports = module.buildInfo.cssData.exports; + const exports = buildInfo.cssData.exports; const stringifiedExports = JSON.stringify( Array.from(exports).reduce((obj, [key, value]) => { obj[key] = value; @@ -246,6 +251,8 @@ class CssGenerator extends Generator { return originalSource.size(); } + default: + return 0; } } diff --git a/lib/css/CssModulesPlugin.js b/lib/css/CssModulesPlugin.js index 75dea82fd..3544ca0eb 100644 --- a/lib/css/CssModulesPlugin.js +++ b/lib/css/CssModulesPlugin.js @@ -56,6 +56,7 @@ const CssParser = require("./CssParser"); /** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../CssModule").Inheritance} Inheritance */ /** @typedef {import("../Module")} Module */ +/** @typedef {import("../Module").BuildInfo} BuildInfo */ /** @typedef {import("../Template").RuntimeTemplate} RuntimeTemplate */ /** @typedef {import("../TemplatedPathPlugin").TemplatePath} TemplatePath */ /** @typedef {import("../util/Hash")} Hash */ @@ -365,10 +366,14 @@ class CssModulesPlugin { NormalModule.getCompilationHooks(compilation).processResult.tap( PLUGIN_NAME, - ([source, ...rest], module) => { + (result, module) => { if (module.type === type) { + const [source, ...rest] = result; + return [removeBOM(source), ...rest]; } + + return result; } ); } @@ -377,7 +382,9 @@ class CssModulesPlugin { compilation ).renderModuleContent.tap(PLUGIN_NAME, (source, module) => { if (module instanceof CssModule && module.hot) { - const exports = module.buildInfo.cssData.exports; + const exports = + /** @type {BuildInfo} */ + (module.buildInfo).cssData.exports; const stringifiedExports = JSON.stringify( JSON.stringify( Array.from(exports).reduce((obj, [key, value]) => { @@ -401,6 +408,8 @@ class CssModulesPlugin { return new ConcatSource(source, "\n", new RawSource(hmrCode)); } + + return source; }); const orderedCssModulesPerChunk = new WeakMap(); compilation.hooks.afterCodeGeneration.tap(PLUGIN_NAME, () => { @@ -486,7 +495,9 @@ class CssModulesPlugin { chunk, chunkGraph, codeGenerationResults, - uniqueName: compilation.outputOptions.uniqueName, + uniqueName: + /** @type {string} */ + (compilation.outputOptions.uniqueName), undoPath, modules, runtimeTemplate diff --git a/lib/css/CssParser.js b/lib/css/CssParser.js index c8ae863d9..343d22e7a 100644 --- a/lib/css/CssParser.js +++ b/lib/css/CssParser.js @@ -379,7 +379,8 @@ class CssParser extends Parser { let lastIdentifier; /** @type {Set} */ const declaredCssVariables = new Set(); - /** @type {Map} */ + /** @typedef {{ path?: string, value: string }} IcssDefinition */ + /** @type {Map} */ const icssDefinitions = new Map(); /** @@ -447,6 +448,7 @@ class CssParser extends Parser { */ const parseImportOrExport = (type, input, pos) => { pos = walkCssTokens.eatWhitespaceAndComments(input, pos); + /** @type {string | undefined} */ let importPath; if (type === 0) { let cc = input.charCodeAt(pos); @@ -517,7 +519,9 @@ class CssParser extends Parser { /** @type {undefined | 0 | 1 | 2} */ let scope; - /** @type {[number, number] | undefined} */ + /** @typedef {[number, number]} Name */ + + /** @type {Name | undefined} */ let name; /** @type {number | undefined} */ let value; @@ -537,10 +541,11 @@ class CssParser extends Parser { balanced--; if (scope === 2) { + const [nameStart, nameEnd] = /** @type {Name} */ (name); createDep( - input.slice(name[0], name[1]), + input.slice(nameStart, nameEnd), input.slice(value, end - 1).trim(), - name[1], + nameEnd, end - 1 ); scope = 0; @@ -571,10 +576,11 @@ class CssParser extends Parser { }, semicolon: (input, _start, end) => { if (scope === 2) { + const [nameStart, nameEnd] = /** @type {Name} */ (name); createDep( - input.slice(name[0], name[1]), + input.slice(nameStart, nameEnd), input.slice(value, end - 1), - name[1], + nameEnd, end - 1 ); scope = 0; @@ -986,7 +992,9 @@ class CssParser extends Parser { } if (icssDefinitions.has(value)) { - const def = icssDefinitions.get(value); + const def = + /** @type {IcssDefinition} */ + (icssDefinitions.get(value)); value = def.value; } @@ -1068,13 +1076,18 @@ class CssParser extends Parser { }, identifier: (input, start, end) => { if (isModules) { - if (icssDefinitions.has(input.slice(start, end))) { - const name = input.slice(start, end); - let { path, value } = icssDefinitions.get(name); + const name = input.slice(start, end); + + if (icssDefinitions.has(name)) { + let { path, value } = + /** @type {IcssDefinition} */ + (icssDefinitions.get(name)); if (path) { if (icssDefinitions.has(path)) { - const definition = icssDefinitions.get(path); + const definition = + /** @type {IcssDefinition} */ + (icssDefinitions.get(path)); path = definition.value.slice(1, -1); } diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index 9f2d445a0..32e9025bc 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -22,6 +22,8 @@ const { dirname, mkdirpSync } = require("../util/fs"); /** @typedef {import("../ContextModuleFactory")} ContextModuleFactory */ /** @typedef {import("../ModuleFactory")} ModuleFactory */ /** @typedef {import("../NormalModuleFactory")} NormalModuleFactory */ +/** @typedef {import("../Parser")} Parser */ +/** @typedef {import("../ResolverFactory")} ResolverFactory */ /** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ /** @typedef {TODO} Inspector */ @@ -92,13 +94,21 @@ class Profiler { sendCommand(method, params) { if (this.hasSession()) { return new Promise((res, rej) => { - this.session.post(method, params, (err, params) => { - if (err !== null) { - rej(err); - } else { - res(params); + this.session.post( + method, + params, + /** + * @param {Error | null} err error + * @param {object} params params + */ + (err, params) => { + if (err !== null) { + rej(err); + } else { + res(params); + } } - }); + ); }); } return Promise.resolve(); @@ -196,6 +206,9 @@ const createTrace = (fs, outputPath) => { trace, counter, profiler, + /** + * @param {() => void} callback callback + */ end: callback => { trace.push("]"); // Wait until the write stream finishes. @@ -242,7 +255,11 @@ class ProfilingPlugin { } for (const hookName of Object.keys(compiler.resolverFactory.hooks)) { - const hook = compiler.resolverFactory.hooks[hookName]; + const hook = + compiler.resolverFactory.hooks[ + /** @type {keyof ResolverFactory["hooks"]} */ + (hookName) + ]; if (hook) { hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName)); } @@ -335,7 +352,7 @@ class ProfilingPlugin { } /** - * @param {any} instance instance + * @param {EXPECTED_ANY & { hooks: TODO }} instance instance * @param {Trace} tracer tracer * @param {string} logLabel log label */ @@ -411,7 +428,6 @@ const makeInterceptorFor = (instance, tracer) => hookName => ({ } }); -// TODO improve typing /** @typedef {(...args: TODO[]) => void | Promise} PluginFunction */ /** @@ -419,7 +435,7 @@ const makeInterceptorFor = (instance, tracer) => hookName => ({ * @param {Trace} tracer The trace object. * @param {object} options Options for the profiled fn. * @param {string} options.name Plugin name - * @param {string} options.type Plugin type (sync | async | promise) + * @param {"sync" | "async" | "promise"} options.type Plugin type (sync | async | promise) * @param {PluginFunction} options.fn Plugin function * @returns {PluginFunction} Chainable hooked function. */ diff --git a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js index 803ce398b..800384737 100644 --- a/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +++ b/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js @@ -163,15 +163,21 @@ class AMDRequireDependenciesBlockParserPlugin { ); } else if (param.string === "module") { dep = new ConstDependency( - /** @type {BuildInfo} */ - (parser.state.module.buildInfo).moduleArgument, + /** @type {string} */ + ( + /** @type {BuildInfo} */ + (parser.state.module.buildInfo).moduleArgument + ), /** @type {Range} */ (param.range), [RuntimeGlobals.module] ); } else if (param.string === "exports") { dep = new ConstDependency( - /** @type {BuildInfo} */ - (parser.state.module.buildInfo).exportsArgument, + /** @type {string} */ + ( + /** @type {BuildInfo} */ + (parser.state.module.buildInfo).exportsArgument + ), /** @type {Range} */ (param.range), [RuntimeGlobals.exports] ); diff --git a/lib/dependencies/CssIcssExportDependency.js b/lib/dependencies/CssIcssExportDependency.js index 1b43d8975..eae414c64 100644 --- a/lib/dependencies/CssIcssExportDependency.js +++ b/lib/dependencies/CssIcssExportDependency.js @@ -58,10 +58,12 @@ class CssIcssExportDependency extends NullDependency { */ getExports(moduleGraph) { const module = /** @type {CssModule} */ (moduleGraph.getParentModule(this)); - const convention = - /** @type {CssGenerator} */ - (module.generator).convention; - const names = this.getExportsConventionNames(this.name, convention); + const generator = /** @type {CssGenerator} */ (module.generator); + const names = this.getExportsConventionNames( + this.name, + /** @type {CssGeneratorExportsConvention} */ + (generator.convention) + ); return { exports: names.map(name => ({ name, @@ -82,12 +84,11 @@ class CssIcssExportDependency extends NullDependency { const module = /** @type {CssModule} */ (chunkGraph.moduleGraph.getParentModule(this)); - const generator = - /** @type {CssGenerator} */ - (module.generator); + const generator = /** @type {CssGenerator} */ (module.generator); const names = this.getExportsConventionNames( this.name, - generator.convention + /** @type {CssGeneratorExportsConvention} */ + (generator.convention) ); this._hashUpdate = JSON.stringify(names); } @@ -128,10 +129,12 @@ CssIcssExportDependency.Template = class CssIcssExportDependencyTemplate extends apply(dependency, source, { cssData, module: m, runtime, moduleGraph }) { const dep = /** @type {CssIcssExportDependency} */ (dependency); const module = /** @type {CssModule} */ (m); - const convention = - /** @type {CssGenerator} */ - (module.generator).convention; - const names = dep.getExportsConventionNames(dep.name, convention); + const generator = /** @type {CssGenerator} */ (module.generator); + const names = dep.getExportsConventionNames( + dep.name, + /** @type {CssGeneratorExportsConvention} */ + (generator.convention) + ); const usedNames = /** @type {string[]} */ ( diff --git a/lib/dependencies/CssIcssImportDependency.js b/lib/dependencies/CssIcssImportDependency.js index 4206b6484..36ab64afb 100644 --- a/lib/dependencies/CssIcssImportDependency.js +++ b/lib/dependencies/CssIcssImportDependency.js @@ -14,6 +14,7 @@ const ModuleDependency = require("./ModuleDependency"); /** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */ +/** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ @@ -74,7 +75,9 @@ CssIcssImportDependency.Template = class CssIcssImportDependencyTemplate extends apply(dependency, source, templateContext) { const dep = /** @type {CssIcssImportDependency} */ (dependency); const { range } = dep; - const module = templateContext.moduleGraph.getModule(dep); + const module = + /** @type {Module} */ + (templateContext.moduleGraph.getModule(dep)); let value; for (const item of module.dependencies) { diff --git a/lib/dependencies/CssLocalIdentifierDependency.js b/lib/dependencies/CssLocalIdentifierDependency.js index 7f8ddbf3b..132788715 100644 --- a/lib/dependencies/CssLocalIdentifierDependency.js +++ b/lib/dependencies/CssLocalIdentifierDependency.js @@ -41,9 +41,10 @@ const getCssParser = memoize(() => require("../css/CssParser")); * @returns {string} local ident */ const getLocalIdent = (local, module, chunkGraph, runtimeTemplate) => { + const generator = /** @type {CssGenerator} */ (module.generator); const localIdentName = - /** @type {CssGenerator} */ - (module.generator).localIdentName; + /** @type {CssGeneratorLocalIdentName} */ + (generator.localIdentName); const relativeResourcePath = makePathsRelative( /** @type {string} */ (module.context), @@ -120,10 +121,11 @@ class CssLocalIdentifierDependency extends NullDependency { */ getExports(moduleGraph) { const module = /** @type {CssModule} */ (moduleGraph.getParentModule(this)); - const convention = - /** @type {CssGenerator} */ - (module.generator).convention; - const names = this.getExportsConventionNames(this.name, convention); + const generator = /** @type {CssGenerator} */ (module.generator); + const names = this.getExportsConventionNames( + this.name, + /** @type {CssGeneratorExportsConvention} */ (generator.convention) + ); return { exports: names.map(name => ({ name, @@ -144,12 +146,11 @@ class CssLocalIdentifierDependency extends NullDependency { const module = /** @type {CssModule} */ (chunkGraph.moduleGraph.getParentModule(this)); - const generator = - /** @type {CssGenerator} */ - (module.generator); + const generator = /** @type {CssGenerator} */ (module.generator); const names = this.getExportsConventionNames( this.name, - generator.convention + /** @type {CssGeneratorExportsConvention} */ + (generator.convention) ); this._hashUpdate = `exportsConvention|${JSON.stringify(names)}|localIdentName|${JSON.stringify(generator.localIdentName)}`; } @@ -214,10 +215,12 @@ CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTempla const { module: m, moduleGraph, runtime, cssData } = templateContext; const dep = /** @type {CssLocalIdentifierDependency} */ (dependency); const module = /** @type {CssModule} */ (m); - const convention = - /** @type {CssGenerator} */ - (module.generator).convention; - const names = dep.getExportsConventionNames(dep.name, convention); + const generator = /** @type {CssGenerator} */ (module.generator); + const names = dep.getExportsConventionNames( + dep.name, + /** @type {CssGeneratorExportsConvention} */ + (generator.convention) + ); const usedNames = /** @type {(string)[]} */ ( diff --git a/lib/dependencies/ExportsInfoDependency.js b/lib/dependencies/ExportsInfoDependency.js index 70383e25d..7fa1a4f56 100644 --- a/lib/dependencies/ExportsInfoDependency.js +++ b/lib/dependencies/ExportsInfoDependency.js @@ -22,13 +22,18 @@ const NullDependency = require("./NullDependency"); /** @typedef {import("../util/Hash")} Hash */ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ +/** + * @template T + * @typedef {import("../util/SortableSet")} SortableSet + */ + /** * @param {ModuleGraph} moduleGraph the module graph * @param {Module} module the module * @param {string[] | null} _exportName name of the export if any * @param {string | null} property name of the requested property * @param {RuntimeSpec} runtime for which runtime - * @returns {any} value of the property + * @returns {undefined | null | number | boolean | string[] | SortableSet} value of the property */ const getProperty = (moduleGraph, module, _exportName, property, runtime) => { if (!_exportName) { diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index fed204b3f..5828dcc0f 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -149,7 +149,6 @@ module.exports = class HarmonyExportDependencyParserPlugin { parser.state.harmonyNamedExports || new Set()); harmonyNamedExports.add(name); InnerGraph.addVariableUsage(parser, id, name); - console.log(settings); const dep = settings ? new HarmonyExportImportedSpecifierDependency( settings.source, @@ -160,7 +159,7 @@ module.exports = class HarmonyExportDependencyParserPlugin { null, exportPresenceMode, null, - settings.assertions + settings.attributes ) : new HarmonyExportSpecifierDependency(id, name); dep.loc = Object.create( diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index 95d4507e2..cee760330 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -157,6 +157,17 @@ const determineExportAssignments = ( return { names: Array.from(names), dependencyIndices }; }; +/** @typedef {string[]} Names */ +/** @typedef {number[]} DependencyIndices */ + +/** + * @param {object} options options + * @param {Names} options.names names + * @param {DependencyIndices} options.dependencyIndices dependency indices + * @param {string} name name + * @param {Iterable} dependencies dependencies + * @returns {HarmonyExportImportedSpecifierDependency | undefined} found dependency or nothing + */ const findDependencyForName = ( { names, dependencyIndices }, name, @@ -415,7 +426,10 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { * @returns {Ids} the imported id */ getIds(moduleGraph) { - return moduleGraph.getMeta(this)[idsSymbol] || this.ids; + return ( + /** @type {TODO} */ + (moduleGraph.getMeta(this))[idsSymbol] || this.ids + ); } /** @@ -619,7 +633,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { /** * @param {ModuleGraph} moduleGraph the module graph - * @returns {{ names: string[], namesSlice: number, dependencyIndices: number[], dependencyIndex: number } | undefined} exported names and their origin dependency + * @returns {{ names: Names, namesSlice: number, dependencyIndices: DependencyIndices, dependencyIndex: number } | undefined} exported names and their origin dependency */ _discoverActiveExportsFromOtherStarExports(moduleGraph) { if (!this.otherStarExports) return; @@ -871,7 +885,11 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { exportInfo.name, this.allStarExports ? this.allStarExports.dependencies - : [...this.otherStarExports, this] + : [ + .../** @type {Iterable} */ + (this.otherStarExports), + this + ] ); if (!conflictingDependency) continue; const target = exportInfo.getTerminalBinding(moduleGraph); diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index e7c556339..97decaec4 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -33,6 +33,7 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend /** @typedef {import("../javascript/JavascriptParser").ImportDeclaration} ImportDeclaration */ /** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */ /** @typedef {import("../javascript/JavascriptParser").Range} Range */ +/** @typedef {import("../javascript/JavascriptParser").TagData} TagData */ /** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */ /** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */ /** @typedef {import("./HarmonyImportDependency")} HarmonyImportDependency */ @@ -46,7 +47,7 @@ const harmonySpecifierTag = Symbol("harmony import"); * @property {number} sourceOrder * @property {string} name * @property {boolean} await - * @property {Record | undefined} assertions + * @property {Record | undefined} attributes */ module.exports = class HarmonyImportDependencyParserPlugin { @@ -138,7 +139,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { source, ids, sourceOrder: parser.state.lastHarmonyImportOrder, - assertions: getImportAttributes(statement) + attributes: getImportAttributes(statement) }); return true; } @@ -164,7 +165,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { rootInfo.tagInfo.tag !== harmonySpecifierTag ) return; - const settings = rootInfo.tagInfo.data; + const settings = /** @type {TagData} */ (rootInfo.tagInfo.data); const members = /** @type {(() => string[])} */ (rightPart.getMembers)(); @@ -174,7 +175,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { settings.ids.concat(members).concat([leftPart]), settings.name, /** @type {Range} */ (expression.range), - settings.assertions, + settings.attributes, "in" ); dep.directImport = members.length === 0; @@ -198,7 +199,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { settings.name, /** @type {Range} */ (expr.range), exportPresenceMode, - settings.assertions, + settings.attributes, [] ); dep.referencedPropertiesInDestructuring = @@ -246,7 +247,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { settings.name, /** @type {Range} */ (expr.range), exportPresenceMode, - settings.assertions, + settings.attributes, ranges ); dep.referencedPropertiesInDestructuring = @@ -293,7 +294,7 @@ module.exports = class HarmonyImportDependencyParserPlugin { settings.name, /** @type {Range} */ (expr.range), exportPresenceMode, - settings.assertions, + settings.attributes, ranges ); dep.directImport = members.length === 0; diff --git a/lib/dependencies/JsonExportsDependency.js b/lib/dependencies/JsonExportsDependency.js index 07d022b90..bbc2a1a68 100644 --- a/lib/dependencies/JsonExportsDependency.js +++ b/lib/dependencies/JsonExportsDependency.js @@ -19,34 +19,50 @@ const NullDependency = require("./NullDependency"); /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ /** @typedef {import("../util/Hash")} Hash */ +/** + * @callback GetExportsFromDataFn + * @param {RawJsonData} data raw json data + * @param {number} [curDepth] current depth + * @returns {ExportSpec[] | null} export spec or nothing + */ + /** * @param {number} exportsDepth exportsDepth - * @returns {((data: RawJsonData, curDepth?: number) => ExportSpec[] | undefined)} value + * @returns {GetExportsFromDataFn} value */ const getExportsWithDepth = exportsDepth => + /** @type {GetExportsFromDataFn} */ function getExportsFromData(data, curDepth = 1) { - if (curDepth > exportsDepth) return undefined; + if (curDepth > exportsDepth) { + return null; + } + if (data && typeof data === "object") { if (Array.isArray(data)) { return data.length < 100 ? data.map((item, idx) => ({ name: `${idx}`, canMangle: true, - exports: getExportsFromData(item, curDepth + 1) + exports: getExportsFromData(item, curDepth + 1) || undefined })) - : undefined; + : null; } + + /** @type {ExportSpec[]} */ const exports = []; + for (const key of Object.keys(data)) { exports.push({ name: key, canMangle: true, - exports: getExportsFromData(data[key], curDepth + 1) + exports: getExportsFromData(data[key], curDepth + 1) || undefined }); } + return exports; } - return undefined; + + return null; }; class JsonExportsDependency extends NullDependency { diff --git a/lib/dependencies/WorkerPlugin.js b/lib/dependencies/WorkerPlugin.js index a45539450..6823e993a 100644 --- a/lib/dependencies/WorkerPlugin.js +++ b/lib/dependencies/WorkerPlugin.js @@ -155,7 +155,7 @@ class WorkerPlugin { const arg1Value = parser.evaluateExpression(arg1); if (!arg1Value.isString()) return; return [ - arg1Value.string, + /** @type {string} */ (arg1Value.string), [ /** @type {Range} */ (arg1.range)[0], /** @type {Range} */ (arg2.range)[1] diff --git a/lib/javascript/BasicEvaluatedExpression.js b/lib/javascript/BasicEvaluatedExpression.js index 05dd14cd1..a7502a412 100644 --- a/lib/javascript/BasicEvaluatedExpression.js +++ b/lib/javascript/BasicEvaluatedExpression.js @@ -7,7 +7,7 @@ /** @typedef {import("estree").Node} Node */ /** @typedef {import("./JavascriptParser").Range} Range */ -/** @typedef {import("./JavascriptParser").VariableInfoInterface} VariableInfoInterface */ +/** @typedef {import("./JavascriptParser").VariableInfo} VariableInfo */ const TypeUnknown = 0; const TypeUndefined = 1; @@ -51,7 +51,7 @@ class BasicEvaluatedExpression { this.quasis = undefined; /** @type {BasicEvaluatedExpression[] | undefined} */ this.parts = undefined; - /** @type {any[] | undefined} */ + /** @type {EXPECTED_ANY[] | undefined} */ this.array = undefined; /** @type {BasicEvaluatedExpression[] | undefined} */ this.items = undefined; @@ -63,9 +63,9 @@ class BasicEvaluatedExpression { this.postfix = undefined; /** @type {BasicEvaluatedExpression[] | undefined} */ this.wrappedInnerExpressions = undefined; - /** @type {string | VariableInfoInterface | undefined} */ + /** @type {string | VariableInfo | undefined} */ this.identifier = undefined; - /** @type {string | VariableInfoInterface | undefined} */ + /** @type {string | VariableInfo | undefined} */ this.rootInfo = undefined; /** @type {(() => string[]) | undefined} */ this.getMembers = undefined; @@ -386,8 +386,8 @@ class BasicEvaluatedExpression { /** * Set's the value of this expression to a particular identifier and its members. - * @param {string | VariableInfoInterface} identifier identifier to set - * @param {string | VariableInfoInterface} rootInfo root info + * @param {string | VariableInfo} identifier identifier to set + * @param {string | VariableInfo} rootInfo root info * @param {() => string[]} getMembers members * @param {() => boolean[]=} getMembersOptionals optional members * @param {() => Range[]=} getMemberRanges ranges of progressively increasing sub-expressions diff --git a/lib/javascript/JavascriptModulesPlugin.js b/lib/javascript/JavascriptModulesPlugin.js index 6c60d460f..83d07713b 100644 --- a/lib/javascript/JavascriptModulesPlugin.js +++ b/lib/javascript/JavascriptModulesPlugin.js @@ -291,10 +291,14 @@ class JavascriptModulesPlugin { NormalModule.getCompilationHooks(compilation).processResult.tap( PLUGIN_NAME, - ([source, ...rest], module) => { + (result, module) => { if (module.type === type) { + const [source, ...rest] = result; + return [removeBOM(source), ...rest]; } + + return result; } ); } diff --git a/lib/javascript/JavascriptParser.js b/lib/javascript/JavascriptParser.js index a56e505e9..8d6da646f 100644 --- a/lib/javascript/JavascriptParser.js +++ b/lib/javascript/JavascriptParser.js @@ -92,7 +92,6 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); */ /** @typedef {import("../Parser").ParserState} ParserState */ /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -/** @typedef {{declaredScope: ScopeInfo, freeName: string | true | undefined, tagInfo: TagInfo | undefined}} VariableInfoInterface */ /** @typedef {{ name: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[], getMembersOptionals: () => boolean[], getMemberRanges: () => Range[] }} GetInfoResult */ /** @typedef {Statement | ModuleDeclaration | Expression} StatementPathItem */ /** @typedef {function(string): void} OnIdentString */ @@ -139,6 +138,7 @@ const importAssertions = Parser => this.expect(tokTypes.braceL); + /** @type {Record} */ const attributeKeys = {}; let first = true; @@ -152,7 +152,9 @@ const importAssertions = Parser => first = false; } - const attr = this.parseImportAttribute(); + const attr = + /** @type {ImportAttribute} */ + this.parseImportAttribute(); const keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value; @@ -272,10 +274,13 @@ class VariableInfo { /** @typedef {Literal | string | null | undefined} ImportSource */ /** @typedef {Omit & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */ +/** @typedef {symbol} Tag */ +/** @typedef {Record} TagData */ + /** * @typedef {object} TagInfo - * @property {any} tag - * @property {any} data + * @property {Tag} tag + * @property {TagData} [data] * @property {TagInfo | undefined} next */ @@ -586,6 +591,7 @@ class JavascriptParser extends Parser { this.prevStatement = undefined; /** @type {WeakMap> | undefined} */ this.destructuringAssignmentProperties = undefined; + /** @type {TagData | undefined} */ this.currentTagData = undefined; this.magicCommentContext = createMagicCommentContext(); this._initializeEvaluating(); @@ -1680,10 +1686,9 @@ class JavascriptParser extends Parser { /** @type {string} */ const value = argExpr.isString() - ? /** @type {string} */ (argExpr.string) - : String(/** @type {number} */ (argExpr.number)); + ? argExpr.string + : String(argExpr.number); - /** @type {string} */ const newString = value + (stringSuffix ? stringSuffix.string : ""); const newRange = /** @type {Range} */ ([ /** @type {Range} */ (argExpr.range)[0], @@ -1859,7 +1864,7 @@ class JavascriptParser extends Parser { /** * @param {Expression | SpreadElement} expr expression - * @returns {string | VariableInfoInterface | undefined} identifier + * @returns {string | VariableInfo | undefined} identifier */ getRenameIdentifier(expr) { const result = this.evaluateExpression(expr); @@ -3539,7 +3544,7 @@ class JavascriptParser extends Parser { _walkIIFE(functionExpression, options, currentThis) { /** * @param {Expression | SpreadElement} argOrThis arg or this - * @returns {string | VariableInfoInterface | undefined} var info + * @returns {string | VariableInfo | undefined} var info */ const getVarInfo = argOrThis => { const renameIdentifier = this.getRenameIdentifier(argOrThis); @@ -4010,7 +4015,7 @@ class JavascriptParser extends Parser { /** * @deprecated - * @param {any} params scope params + * @param {(string | Pattern | Property)[]} params scope params * @param {function(): void} fn inner function * @returns {void} */ @@ -4733,8 +4738,8 @@ class JavascriptParser extends Parser { /** * @param {string} name name - * @param {symbol} tag tag info - * @returns {TODO} tag data + * @param {Tag} tag tag info + * @returns {TagData | undefined} tag data */ getTagData(name, tag) { const info = this.scope.definitions.get(name); @@ -4749,8 +4754,8 @@ class JavascriptParser extends Parser { /** * @param {string} name name - * @param {symbol} tag tag info - * @param {TODO=} data data + * @param {Tag} tag tag info + * @param {TagData=} data data */ tagVariable(name, tag, data) { const oldInfo = this.scope.definitions.get(name); diff --git a/lib/library/AssignLibraryPlugin.js b/lib/library/AssignLibraryPlugin.js index abdcfcf41..ac1313cd5 100644 --- a/lib/library/AssignLibraryPlugin.js +++ b/lib/library/AssignLibraryPlugin.js @@ -19,7 +19,6 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin"); /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */ -/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Module")} Module */ /** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */ /** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */ diff --git a/lib/library/EnableLibraryPlugin.js b/lib/library/EnableLibraryPlugin.js index a772eac8e..2c7ae3415 100644 --- a/lib/library/EnableLibraryPlugin.js +++ b/lib/library/EnableLibraryPlugin.js @@ -212,6 +212,9 @@ class EnableLibraryPlugin { compiler.options.output.iife = true; class WarnFalseIifeUmdPlugin { + /** + * @param {Compiler} compiler the compiler instance + */ apply(compiler) { compiler.hooks.thisCompilation.tap( "WarnFalseIifeUmdPlugin", diff --git a/lib/node/ReadFileCompileAsyncWasmPlugin.js b/lib/node/ReadFileCompileAsyncWasmPlugin.js index d53f1a83d..195f640be 100644 --- a/lib/node/ReadFileCompileAsyncWasmPlugin.js +++ b/lib/node/ReadFileCompileAsyncWasmPlugin.js @@ -50,8 +50,7 @@ class ReadFileCompileAsyncWasmPlugin { }; /** - * @param {string} path path to wasm file - * @returns {string} generated code to load the wasm file + * @type {(path: string) => string} callback to generate code to load the wasm file */ const generateLoadBinaryCode = this._import ? path => diff --git a/lib/node/ReadFileCompileWasmPlugin.js b/lib/node/ReadFileCompileWasmPlugin.js index 59e58b5f3..5dfe3cf45 100644 --- a/lib/node/ReadFileCompileWasmPlugin.js +++ b/lib/node/ReadFileCompileWasmPlugin.js @@ -53,8 +53,7 @@ class ReadFileCompileWasmPlugin { }; /** - * @param {string} path path to wasm file - * @returns {string} generated code to load the wasm file + * @type {(path: string) => string} callback to generate code to load the wasm file */ const generateLoadBinaryCode = this.options.import ? path => diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index c305c3dde..8055859ac 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -98,7 +98,7 @@ const { // fix eslint-scope to support class properties correctly // cspell:word Referencer -const ReferencerClass = /** @type {any} */ (Referencer); +const ReferencerClass = /** @type {EXPECTED_ANY} */ (Referencer); if (!ReferencerClass.prototype.PropertyDefinition) { ReferencerClass.prototype.PropertyDefinition = ReferencerClass.prototype.Property; diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index 0edb048db..fcbd1870b 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -43,7 +43,7 @@ const formatLocation = require("../formatLocation"); /** @typedef {Map} CacheItem */ -/** @type {WeakMap} */ +/** @type {WeakMap} */ const globToRegexpCache = new WeakMap(); /** diff --git a/lib/serialization/BinaryMiddleware.js b/lib/serialization/BinaryMiddleware.js index 2db7487a2..f094347f5 100644 --- a/lib/serialization/BinaryMiddleware.js +++ b/lib/serialization/BinaryMiddleware.js @@ -7,6 +7,8 @@ const memoize = require("../util/memoize"); const SerializerMiddleware = require("./SerializerMiddleware"); +/** @typedef {import("./SerializerMiddleware").Context} Context */ +/** @typedef {import("./SerializerMiddleware").LazyFn} LazyFn */ /** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ /** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ @@ -135,8 +137,6 @@ const identifyBigInt = n => { return 2; }; -/** @typedef {TODO} Context */ - /** * @typedef {PrimitiveSerializableType[]} DeserializedType * @typedef {BufferSerializableType[]} SerializedType @@ -145,8 +145,8 @@ const identifyBigInt = n => { class BinaryMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {Context} context context object + * @returns {SerializedType | Promise} serialized data */ serialize(data, context) { return this._serialize(data, context); @@ -154,7 +154,7 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {function(): Promise | any} fn lazy function - * @param {TODO} context serialize function + * @param {Context} context serialize function * @returns {function(): Promise | any} new lazy */ _serializeLazy(fn, context) { @@ -165,7 +165,7 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {TODO} context context object + * @param {Context} context context object * @param {{ leftOverBuffer: Buffer | null, allocationSize: number, increaseCounter: number }} allocationScope allocation scope * @returns {SerializedType} serialized data */ @@ -644,13 +644,19 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {Context} context context object + * @returns {DeserializedType | Promise} deserialized data */ deserialize(data, context) { return this._deserialize(data, context); } + /** + * @private + * @param {SerializedType} content content + * @param {Context} context context object + * @returns {LazyFn} lazy function + */ _createLazyDeserialized(content, context) { return SerializerMiddleware.createLazy( memoize(() => this._deserialize(content, context)), @@ -660,6 +666,12 @@ class BinaryMiddleware extends SerializerMiddleware { ); } + /** + * @private + * @param {LazyFn} fn lazy function + * @param {Context} context context object + * @returns {TODO} new lazy + */ _deserializeLazy(fn, context) { return SerializerMiddleware.deserializeLazy(fn, data => this._deserialize(data, context) @@ -668,7 +680,7 @@ class BinaryMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {TODO} context context object + * @param {Context} context context object * @returns {DeserializedType} deserialized data */ _deserialize(data, context) { diff --git a/lib/serialization/FileMiddleware.js b/lib/serialization/FileMiddleware.js index b8de8a958..71a3a00d0 100644 --- a/lib/serialization/FileMiddleware.js +++ b/lib/serialization/FileMiddleware.js @@ -21,6 +21,8 @@ const SerializerMiddleware = require("./SerializerMiddleware"); /** @typedef {typeof import("../util/Hash")} Hash */ /** @typedef {import("../util/fs").IStats} IStats */ /** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */ +/** @typedef {import("./SerializerMiddleware").Context} Context */ +/** @typedef {import("./SerializerMiddleware").LazyFn} LazyFn */ /** @typedef {import("./types").BufferSerializableType} BufferSerializableType */ /* @@ -103,7 +105,7 @@ const serialize = async ( ) => { /** @type {(Buffer[] | Buffer | SerializeResult | Promise)[]} */ const processedData = []; - /** @type {WeakMap>} */ + /** @type {WeakMap} */ const resultToLazy = new WeakMap(); /** @type {Buffer[] | undefined} */ let lastBuffers; @@ -428,8 +430,8 @@ class FileMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {Context} context context object + * @returns {SerializedType | Promise} serialized data */ serialize(data, context) { const { filename, extension = "" } = context; @@ -483,7 +485,7 @@ class FileMiddleware extends SerializerMiddleware { stream.on("finish", () => resolve()); } // split into chunks for WRITE_LIMIT_CHUNK size - /** @type {TODO[]} */ + /** @type {Buffer[]} */ const chunks = []; for (const b of content) { if (b.length < WRITE_LIMIT_CHUNK) { @@ -590,14 +592,14 @@ class FileMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {Context} context context object + * @returns {DeserializedType | Promise} deserialized data */ deserialize(data, context) { const { filename, extension = "" } = context; /** * @param {string | boolean} name name - * @returns {Promise} result + * @returns {Promise} result */ const readFile = name => new Promise((resolve, reject) => { diff --git a/lib/serialization/ObjectMiddleware.js b/lib/serialization/ObjectMiddleware.js index 134644781..a84f97176 100644 --- a/lib/serialization/ObjectMiddleware.js +++ b/lib/serialization/ObjectMiddleware.js @@ -16,6 +16,7 @@ const SerializerMiddleware = require("./SerializerMiddleware"); const SetObjectSerializer = require("./SetObjectSerializer"); /** @typedef {typeof import("../util/Hash")} Hash */ +/** @typedef {import("./SerializerMiddleware").Context} Context */ /** @typedef {import("./types").ComplexSerializableType} ComplexSerializableType */ /** @typedef {import("./types").PrimitiveSerializableType} PrimitiveSerializableType */ @@ -43,12 +44,24 @@ Technically any value can be used. */ +/** + * @typedef {object} ObjectSerializerSnapshot + * @property {number} length + * @property {number} cycleStackSize + * @property {number} referenceableSize + * @property {number} currentPos + * @property {number} objectTypeLookupSize + * @property {number} currentPosTypeLookup + */ + /** * @typedef {object} ObjectSerializerContext * @property {function(any): void} write + * @property {function(any): void} setCircularReference + * @property {function(): ObjectSerializerSnapshot} snapshot + * @property {function(ObjectSerializerSnapshot): void} rollback * @property {(function(any): void)=} writeLazy * @property {(function(any, object=): (() => Promise | any))=} writeSeparate - * @property {function(any): void} setCircularReference */ /** @@ -109,7 +122,10 @@ const ESCAPE_UNDEFINED = false; const CURRENT_VERSION = 2; -/** @type {Map} */ +/** @typedef {{ request?: string, name?: string | number | null, serializer?: ObjectSerializer }} SerializerConfig */ +/** @typedef {{ request?: string, name?: string | number | null, serializer: ObjectSerializer }} SerializerConfigWithSerializer */ + +/** @type {Map} */ const serializers = new Map(); /** @type {Map} */ const serializerInversed = new Map(); @@ -119,6 +135,8 @@ const loadedRequests = new Set(); const NOT_SERIALIZABLE = {}; +/** @typedef {TODO} Item */ + const jsTypes = new Map(); jsTypes.set(Object, new PlainObjectSerializer()); jsTypes.set(Array, new ArraySerializer()); @@ -241,6 +259,10 @@ class ObjectMiddleware extends SerializerMiddleware { serializers.set(Constructor, NOT_SERIALIZABLE); } + /** + * @param {TODO} object for serialization + * @returns {SerializerConfigWithSerializer} Serializer config + */ static getSerializerFor(object) { const proto = Object.getPrototypeOf(object); let c; @@ -260,12 +282,12 @@ class ObjectMiddleware extends SerializerMiddleware { if (!config) throw new Error(`No serializer registered for ${c.name}`); if (config === NOT_SERIALIZABLE) throw NOT_SERIALIZABLE; - return config; + return /** @type {SerializerConfigWithSerializer} */ (config); } /** * @param {string} request request - * @param {TODO} name name + * @param {string} name name * @returns {ObjectSerializer} serializer */ static getDeserializerFor(request, name) { @@ -292,14 +314,18 @@ class ObjectMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {Context} context context object + * @returns {SerializedType | Promise} serialized data */ serialize(data, context) { - /** @type {any[]} */ + /** @type {Item[]} */ let result = [CURRENT_VERSION]; let currentPos = 0; + /** @type {Map} */ let referenceable = new Map(); + /** + * @param {Item} item referenceable item + */ const addReferenceable = item => { referenceable.set(item, currentPos++); }; @@ -368,6 +394,10 @@ class ObjectMiddleware extends SerializerMiddleware { let currentPosTypeLookup = 0; let objectTypeLookup = new Map(); const cycleStack = new Set(); + /** + * @param {Item} item item to stack + * @returns {string} stack + */ const stackToString = item => { const arr = Array.from(cycleStack); arr.push(item); @@ -411,15 +441,16 @@ class ObjectMiddleware extends SerializerMiddleware { try { return `${item}`; } catch (err) { - return `(${err.message})`; + return `(${/** @type {Error} */ (err).message})`; } }) .join(" -> "); }; /** @type {WeakSet} */ let hasDebugInfoAttached; + /** @type {ObjectSerializerContext} */ let ctx = { - write(value, key) { + write(value) { try { process(value); } catch (err) { @@ -459,6 +490,9 @@ class ObjectMiddleware extends SerializerMiddleware { ...context }; this.extendContext(ctx); + /** + * @param {Item} item item to serialize + */ const process = item => { if (Buffer.isBuffer(item)) { // check if we can emit a reference @@ -599,8 +633,8 @@ class ObjectMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {Context} context context object + * @returns {DeserializedType | Promise} deserialized data */ deserialize(data, context) { let currentDataPos = 0; @@ -615,14 +649,20 @@ class ObjectMiddleware extends SerializerMiddleware { throw new Error("Version mismatch, serializer changed"); let currentPos = 0; + /** @type {Item[]} */ let referenceable = []; + /** + * @param {Item} item referenceable item + */ const addReferenceable = item => { referenceable.push(item); currentPos++; }; let currentPosTypeLookup = 0; + /** @type {ObjectSerializer[]} */ let objectTypeLookup = []; let result = []; + /** @type {ObjectDeserializerContext} */ let ctx = { read() { return decodeValue(); diff --git a/lib/serialization/Serializer.js b/lib/serialization/Serializer.js index ce241c670..6c820166c 100644 --- a/lib/serialization/Serializer.js +++ b/lib/serialization/Serializer.js @@ -4,6 +4,8 @@ "use strict"; +/** @typedef {import("./SerializerMiddleware").Context} Context */ + /** * @template T, K * @typedef {import("./SerializerMiddleware")} SerializerMiddleware @@ -12,7 +14,7 @@ class Serializer { /** * @param {SerializerMiddleware[]} middlewares serializer middlewares - * @param {TODO=} context context + * @param {Context} [context] context */ constructor(middlewares, context) { this.serializeMiddlewares = middlewares.slice(); @@ -22,7 +24,7 @@ class Serializer { /** * @param {any} obj object - * @param {TODO} context content + * @param {Context} context context object * @returns {Promise} result */ serialize(obj, context) { @@ -44,7 +46,7 @@ class Serializer { /** * @param {any} value value - * @param {TODO} context context + * @param {Context} context object * @returns {Promise} result */ deserialize(value, context) { diff --git a/lib/serialization/SerializerMiddleware.js b/lib/serialization/SerializerMiddleware.js index 0053fb0b6..75e03c634 100644 --- a/lib/serialization/SerializerMiddleware.js +++ b/lib/serialization/SerializerMiddleware.js @@ -9,6 +9,10 @@ const memoize = require("../util/memoize"); const LAZY_TARGET = Symbol("lazy serialization target"); const LAZY_SERIALIZED_VALUE = Symbol("lazy serialization data"); +/** @typedef {TODO} Context */ +/** @typedef {function(): Promise | any} LazyFn */ +/** @typedef {Record} LazyOptions */ + /** * @template DeserializedType * @template SerializedType @@ -18,8 +22,8 @@ class SerializerMiddleware { /** * @abstract * @param {DeserializedType} data data - * @param {object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {Context} context context object + * @returns {SerializedType | Promise} serialized data */ serialize(data, context) { const AbstractMethodError = require("../AbstractMethodError"); @@ -30,8 +34,8 @@ class SerializerMiddleware { /** * @abstract * @param {SerializedType} data data - * @param {object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {Context} context context object + * @returns {DeserializedType | Promise} deserialized data */ deserialize(data, context) { const AbstractMethodError = require("../AbstractMethodError"); @@ -39,11 +43,11 @@ class SerializerMiddleware { } /** - * @param {any | function(): Promise | any} value contained value or function to value + * @param {any | LazyFn} value contained value or function to value * @param {SerializerMiddleware} target target middleware - * @param {object=} options lazy options + * @param {LazyOptions=} options lazy options * @param {any=} serializedValue serialized value - * @returns {function(): Promise | any} lazy function + * @returns {LazyFn} lazy function */ static createLazy(value, target, options = {}, serializedValue = undefined) { if (SerializerMiddleware.isLazy(value, target)) return value; @@ -55,7 +59,7 @@ class SerializerMiddleware { } /** - * @param {function(): Promise | any} fn lazy function + * @param {LazyFn} fn lazy function * @param {SerializerMiddleware=} target target middleware * @returns {boolean} true, when fn is a lazy function (optionally of that target) */ @@ -66,8 +70,8 @@ class SerializerMiddleware { } /** - * @param {function(): Promise | any} fn lazy function - * @returns {object | undefined} options + * @param {LazyFn} fn lazy function + * @returns {LazyOptions | undefined} options */ static getLazyOptions(fn) { if (typeof fn !== "function") return; @@ -75,7 +79,7 @@ class SerializerMiddleware { } /** - * @param {function(): Promise | any} fn lazy function + * @param {LazyFn} fn lazy function * @returns {any | undefined} serialized value */ static getLazySerializedValue(fn) { @@ -84,7 +88,7 @@ class SerializerMiddleware { } /** - * @param {function(): Promise | any} fn lazy function + * @param {LazyFn} fn lazy function * @param {any} value serialized value * @returns {void} */ @@ -93,9 +97,9 @@ class SerializerMiddleware { } /** - * @param {function(): Promise | any} lazy lazy function + * @param {LazyFn} lazy lazy function * @param {function(any): Promise | any} serialize serialize function - * @returns {function(): Promise | any} new lazy + * @returns {LazyFn} new lazy */ static serializeLazy(lazy, serialize) { const fn = memoize(() => { @@ -113,7 +117,7 @@ class SerializerMiddleware { /** * @template T - * @param {function(): Promise | any} lazy lazy function + * @param {LazyFn} lazy lazy function * @param {function(T): Promise | T} deserialize deserialize function * @returns {function(): Promise | T} new lazy */ @@ -132,8 +136,8 @@ class SerializerMiddleware { } /** - * @param {function(): Promise | any} lazy lazy function - * @returns {function(): Promise | any} new lazy + * @param {LazyFn} lazy lazy function + * @returns {LazyFn} new lazy */ static unMemoizeLazy(lazy) { if (!SerializerMiddleware.isLazy(lazy)) return lazy; diff --git a/lib/serialization/SingleItemMiddleware.js b/lib/serialization/SingleItemMiddleware.js index faf95de6a..23e72f7d8 100644 --- a/lib/serialization/SingleItemMiddleware.js +++ b/lib/serialization/SingleItemMiddleware.js @@ -6,16 +6,19 @@ const SerializerMiddleware = require("./SerializerMiddleware"); +/** @typedef {import("./SerializerMiddleware").Context} Context */ + +/** @typedef {any} DeserializedType */ +/** @typedef {any[]} SerializedType */ + /** - * @typedef {any} DeserializedType - * @typedef {any[]} SerializedType - * @extends {SerializerMiddleware} + * @extends {SerializerMiddleware} */ class SingleItemMiddleware extends SerializerMiddleware { /** * @param {DeserializedType} data data - * @param {object} context context object - * @returns {SerializedType|Promise} serialized data + * @param {Context} context context object + * @returns {SerializedType | Promise} serialized data */ serialize(data, context) { return [data]; @@ -23,8 +26,8 @@ class SingleItemMiddleware extends SerializerMiddleware { /** * @param {SerializedType} data data - * @param {object} context context object - * @returns {DeserializedType|Promise} deserialized data + * @param {Context} context context object + * @returns {DeserializedType | Promise} deserialized data */ deserialize(data, context) { return data[0]; diff --git a/lib/stats/DefaultStatsFactoryPlugin.js b/lib/stats/DefaultStatsFactoryPlugin.js index 2922e5095..965e5bc40 100644 --- a/lib/stats/DefaultStatsFactoryPlugin.js +++ b/lib/stats/DefaultStatsFactoryPlugin.js @@ -2372,8 +2372,8 @@ const sortOrderRegular = field => { const sortByField = field => { if (!field) { /** - * @param {any} a first - * @param {any} b second + * @param {T} a first + * @param {T} b second * @returns {-1|0|1} zero */ const noSort = (a, b) => 0; diff --git a/lib/util/LazySet.js b/lib/util/LazySet.js index 623c1c5a3..392b379da 100644 --- a/lib/util/LazySet.js +++ b/lib/util/LazySet.js @@ -148,8 +148,9 @@ class LazySet { } /** + * @template K * @param {function(T, T, Set): void} callbackFn function called for each entry - * @param {any} thisArg this argument for the callbackFn + * @param {K} thisArg this argument for the callbackFn * @returns {void} */ forEach(callbackFn, thisArg) { diff --git a/lib/util/WeakTupleMap.js b/lib/util/WeakTupleMap.js index ac64e8695..e0e318436 100644 --- a/lib/util/WeakTupleMap.js +++ b/lib/util/WeakTupleMap.js @@ -17,7 +17,7 @@ */ /** - * @param {any} thing thing + * @param {EXPECTED_ANY} thing thing * @returns {boolean} true if is weak */ const isWeakKey = thing => typeof thing === "object" && thing !== null; diff --git a/lib/util/deprecation.js b/lib/util/deprecation.js index d59cbd78f..801127163 100644 --- a/lib/util/deprecation.js +++ b/lib/util/deprecation.js @@ -226,8 +226,8 @@ module.exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => { /** * @param {T} target target * @param {string | symbol} property property - * @param {any} value value - * @param {any} receiver receiver + * @param {EXPECTED_ANY} value value + * @param {EXPECTED_ANY} receiver receiver * @returns {boolean} result */ (target, property, value, receiver) => diff --git a/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js b/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js index 34b6341ce..7d5fedf8b 100644 --- a/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +++ b/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js @@ -42,6 +42,10 @@ class UniversalCompileAsyncWasmPlugin { Template.indent(["return fallback();"]), "}" ]); + /** + * @param {string} path path + * @returns {string} code + */ const generateBeforeLoadBinaryCode = path => Template.asString([ "var useFetch = typeof document !== 'undefined' || typeof self !== 'undefined';", diff --git a/package.json b/package.json index c52c83774..1eb620691 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "toml": "^3.0.0", "tooling": "webpack/tooling#v1.23.5", "ts-loader": "^9.5.1", - "typescript": "^5.7.3", + "typescript": "^5.8.2", "url-loader": "^4.1.0", "wast-loader": "^1.12.1", "webassembly-feature": "1.3.0", diff --git a/types.d.ts b/types.d.ts index 1d114975a..41b6daba9 100644 --- a/types.d.ts +++ b/types.d.ts @@ -556,8 +556,8 @@ declare abstract class BasicEvaluatedExpression { prefix?: null | BasicEvaluatedExpression; postfix?: null | BasicEvaluatedExpression; wrappedInnerExpressions?: BasicEvaluatedExpression[]; - identifier?: string | VariableInfoInterface; - rootInfo?: string | VariableInfoInterface; + identifier?: string | VariableInfo; + rootInfo?: string | VariableInfo; getMembers?: () => string[]; getMembersOptionals?: () => boolean[]; getMemberRanges?: () => [number, number][]; @@ -716,8 +716,8 @@ declare abstract class BasicEvaluatedExpression { * Set's the value of this expression to a particular identifier and its members. */ setIdentifier( - identifier: string | VariableInfoInterface, - rootInfo: string | VariableInfoInterface, + identifier: string | VariableInfo, + rootInfo: string | VariableInfo, getMembers: () => string[], getMembersOptionals?: () => boolean[], getMemberRanges?: () => [number, number][] @@ -1993,7 +1993,7 @@ declare class Compilation { namedChunkGroups: Map; namedChunks: Map; modules: Set; - records: any; + records: null | Record; additionalChunkAssets: string[]; assets: CompilationAssets; assetsInfo: Map; @@ -2004,8 +2004,8 @@ declare class Compilation { dependencyFactories: Map; dependencyTemplates: DependencyTemplates; childrenCounters: Record; - usedChunkIds: Set; - usedModuleIds: Set; + usedChunkIds: null | Set; + usedModuleIds: null | Set; needAdditionalPass: boolean; builtModules: WeakSet; codeGeneratedModules: WeakSet; @@ -6374,7 +6374,7 @@ declare class JavascriptParser extends Parser { Expression, Set >; - currentTagData: any; + currentTagData?: TagData; magicCommentContext: Context; destructuringAssignmentPropertiesFor( node: Expression @@ -6409,7 +6409,7 @@ declare class JavascriptParser extends Parser { | UpdateExpression | YieldExpression | SpreadElement - ): undefined | string | VariableInfoInterface; + ): undefined | string | VariableInfo; walkClass(classy: ClassExpression | ClassDeclaration): void; /** @@ -6842,7 +6842,19 @@ declare class JavascriptParser extends Parser { defined: undefined | (() => any), ...args: AsArray ): undefined | R; - inScope(params: any, fn: () => void): void; + inScope( + params: ( + | string + | Identifier + | MemberExpression + | ObjectPattern + | ArrayPattern + | RestElement + | AssignmentPattern + | Property + )[], + fn: () => void + ): void; inExecutedPath(state: boolean, fn: () => void): void; inClassScope(hasThis: boolean, params: Identifier[], fn: () => void): void; inFunctionScope( @@ -7016,8 +7028,8 @@ declare class JavascriptParser extends Parser { setAsiPosition(pos: number): void; unsetAsiPosition(pos: number): void; isStatementLevelExpression(expr: Expression): boolean; - getTagData(name: string, tag: symbol): any; - tagVariable(name: string, tag: symbol, data?: any): void; + getTagData(name: string, tag: symbol): undefined | TagData; + tagVariable(name: string, tag: symbol, data?: TagData): void; defineVariable(name: string): void; undefineVariable(name: string): void; isVariableDefined(name: string): boolean; @@ -7954,9 +7966,9 @@ declare class LazySet { clear(): void; delete(value: T): boolean; entries(): IterableIterator<[T, T]>; - forEach( + forEach( callbackFn: (arg0: T, arg1: T, arg2: Set) => void, - thisArg?: any + thisArg: K ): void; has(item: T): boolean; keys(): IterableIterator; @@ -10060,9 +10072,19 @@ declare interface ObjectSerializer { } declare interface ObjectSerializerContext { write: (arg0?: any) => void; + setCircularReference: (arg0?: any) => void; + snapshot: () => ObjectSerializerSnapshot; + rollback: (arg0: ObjectSerializerSnapshot) => void; writeLazy?: (arg0?: any) => void; writeSeparate?: (arg0: any, arg1?: object) => () => any; - setCircularReference: (arg0?: any) => void; +} +declare interface ObjectSerializerSnapshot { + length: number; + cycleStackSize: number; + referenceableSize: number; + currentPos: number; + objectTypeLookupSize: number; + currentPosTypeLookup: number; } declare class OccurrenceChunkIdsPlugin { constructor(options?: OccurrenceChunkIdsPluginOptions); @@ -13955,11 +13977,11 @@ declare abstract class Serializer { declare abstract class SerializerMiddleware { serialize( data: DeserializedType, - context: object + context?: any ): SerializedType | Promise; deserialize( data: SerializedType, - context: object + context?: any ): DeserializedType | Promise; } type ServerOptionsHttps< @@ -15159,6 +15181,9 @@ declare interface SyntheticDependencyLocation { declare const TOMBSTONE: unique symbol; declare const TRANSITIVE: unique symbol; declare const TRANSITIVE_ONLY: unique symbol; +declare interface TagData { + [index: string]: any; +} /** * Helper function for joining two ranges into a single range. This is useful @@ -15166,8 +15191,8 @@ declare const TRANSITIVE_ONLY: unique symbol; * to create the range of the _parent node_. */ declare interface TagInfo { - tag: any; - data: any; + tag: symbol; + data?: TagData; next?: TagInfo; } declare interface TargetItem { @@ -15275,11 +15300,6 @@ declare class VariableInfo { freeName?: string | true; tagInfo?: TagInfo; } -declare interface VariableInfoInterface { - declaredScope: ScopeInfo; - freeName?: string | true; - tagInfo?: TagInfo; -} type WarningFilterItemTypes = | string | RegExp diff --git a/yarn.lock b/yarn.lock index 57b73e723..360ff8ea9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5099,8 +5099,7 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== -"prettier-2@npm:prettier@^2", prettier@^2.0.5: - name prettier-2 +"prettier-2@npm:prettier@^2": version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== @@ -5112,6 +5111,11 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" +prettier@^2.0.5: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + prettier@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.1.tgz#22fac9d0b18c0b92055ac8fb619ac1c7bef02fb7" @@ -6074,10 +6078,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@^5.7.3: - version "5.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" - integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== +typescript@^5.8.2: + version "5.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.2.tgz#8170b3702f74b79db2e5a96207c15e65807999e4" + integrity sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ== uglify-js@^3.1.4: version "3.19.3"