@@ -46,2 +46,3 @@ /* | ||
| /** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */ | ||
| /** @typedef {import("../Module")} Module */ | ||
| /** @typedef {import("../Module").NameForCondition} NameForCondition */ | ||
@@ -58,2 +59,4 @@ /** @typedef {import("../Module").BuildInfo} BuildInfo */ | ||
| /** @typedef {(source: string | Buffer, context: { filename: string, module: Module }) => string} DataUrlFunction */ | ||
| /** | ||
@@ -210,7 +213,13 @@ * @template T | ||
| super(); | ||
| /** @type {AssetGeneratorOptions["dataUrl"] | undefined} */ | ||
| this.dataUrlOptions = dataUrlOptions; | ||
| /** @type {AssetModuleFilename | undefined} */ | ||
| this.filename = filename; | ||
| /** @type {RawPublicPath | undefined} */ | ||
| this.publicPath = publicPath; | ||
| /** @type {AssetModuleOutputPath | undefined} */ | ||
| this.outputPath = outputPath; | ||
| /** @type {boolean | undefined} */ | ||
| this.emit = emit; | ||
| /** @type {ModuleGraph} */ | ||
| this._moduleGraph = moduleGraph; | ||
@@ -217,0 +226,0 @@ } |
@@ -12,2 +12,3 @@ /* | ||
| /** @typedef {import("../../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */ | ||
| /** @typedef {import("../Module")} Module */ | ||
| /** @typedef {import("../Module").BuildInfo} BuildInfo */ | ||
@@ -18,2 +19,4 @@ /** @typedef {import("../Module").BuildMeta} BuildMeta */ | ||
| /** @typedef {((source: string | Buffer, context: { filename: string, module: Module }) => boolean)} AssetParserDataUrlFunction */ | ||
| class AssetParser extends Parser { | ||
@@ -25,2 +28,3 @@ /** | ||
| super(); | ||
| /** @type {AssetParserOptions["dataUrlCondition"] | boolean} */ | ||
| this.dataUrlCondition = dataUrlCondition; | ||
@@ -27,0 +31,0 @@ } |
@@ -19,7 +19,7 @@ /* | ||
| /** @typedef {(ChunkGroupOptions & { entryOptions?: EntryOptions } & { circular?: boolean }) | string} GroupOptions */ | ||
| /** @typedef {(ChunkGroupOptions & { entryOptions?: EntryOptions } & { circular?: boolean })} GroupOptions */ | ||
| class AsyncDependenciesBlock extends DependenciesBlock { | ||
| /** | ||
| * @param {GroupOptions | null} groupOptions options for the group | ||
| * @param {GroupOptions | string | null} groupOptions options for the group | ||
| * @param {(DependencyLocation | null)=} loc the line of code | ||
@@ -39,4 +39,7 @@ * @param {(string | null)=} request the request | ||
| } | ||
| /** @type {GroupOptions} */ | ||
| this.groupOptions = groupOptions; | ||
| /** @type {DependencyLocation | null | undefined} */ | ||
| this.loc = loc; | ||
| /** @type {string | null | undefined} */ | ||
| this.request = request; | ||
@@ -43,0 +46,0 @@ /** @type {undefined | string} */ |
@@ -27,3 +27,5 @@ /* | ||
| this.name = "AsyncDependencyToInitialChunkError"; | ||
| /** @type {Module} */ | ||
| this.module = module; | ||
| /** @type {DependencyLocation} */ | ||
| this.loc = loc; | ||
@@ -30,0 +32,0 @@ } |
@@ -15,8 +15,10 @@ /* | ||
| /** @typedef {import("webpack-sources").Source} Source */ | ||
| /** @typedef {import("../declarations/plugins/BannerPlugin").BannerFunction} BannerFunction */ | ||
| /** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */ | ||
| /** @typedef {import("./Compilation").PathData} PathData */ | ||
| /** @typedef {import("./Compiler")} Compiler */ | ||
| /** @typedef {import("./Chunk")} Chunk */ | ||
| /** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */ | ||
| /** @typedef {(data: { hash?: string, chunk: Chunk, filename: string }) => string} BannerFunction */ | ||
| const validate = createSchemaValidation( | ||
@@ -23,0 +25,0 @@ /** @type {((value: typeof import("../schemas/plugins/BannerPlugin.json")) => boolean)} */ |
+4
-4
@@ -70,2 +70,3 @@ /* | ||
| /** @typedef {Record<string, ChunkChildIdsByOrdersMap>} ChunkChildIdsByOrdersMapByData */ | ||
| /** @typedef {{ onChunks: Chunk[], chunks: Chunks }} ChunkChildOfTypeInOrder */ | ||
@@ -778,3 +779,3 @@ let debugId = 1000; | ||
| * @param {string} type option name | ||
| * @returns {{ onChunks: Chunk[], chunks: Chunks }[] | undefined} referenced chunks for a specific type | ||
| * @returns {ChunkChildOfTypeInOrder[] | undefined} referenced chunks for a specific type | ||
| */ | ||
@@ -803,6 +804,5 @@ getChildrenOfTypeInOrder(chunkGraph, type) { | ||
| }); | ||
| /** @typedef {{ onChunks: Chunk[], chunks: Chunks }} Entry */ | ||
| /** @type {Entry[]} */ | ||
| /** @type {ChunkChildOfTypeInOrder[]} */ | ||
| const result = []; | ||
| /** @type {undefined | Entry} */ | ||
| /** @type {undefined | ChunkChildOfTypeInOrder} */ | ||
| let lastEntry; | ||
@@ -809,0 +809,0 @@ for (const { group, childGroup } of list) { |
@@ -24,7 +24,12 @@ /* | ||
| this.name = "ChunkRenderError"; | ||
| /** @type {Chunk} */ | ||
| this.chunk = chunk; | ||
| /** @type {string} */ | ||
| this.file = file; | ||
| /** @type {Error} */ | ||
| this.error = error; | ||
| /** @type {string} */ | ||
| this.message = error.message; | ||
| /** @type {string} */ | ||
| this.details = error.stack; | ||
| this.file = file; | ||
| this.chunk = chunk; | ||
| } | ||
@@ -31,0 +36,0 @@ } |
+1
-1
@@ -42,3 +42,3 @@ /* | ||
| /** @typedef {import("../declarations/WebpackOptions").Plugins} Plugins */ | ||
| /** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ | ||
| /** @typedef {import("./webpack").WebpackPluginFunction} WebpackPluginFunction */ | ||
| /** @typedef {import("./Chunk")} Chunk */ | ||
@@ -45,0 +45,0 @@ /** @typedef {import("./Dependency")} Dependency */ |
@@ -21,4 +21,7 @@ /* | ||
| super(); | ||
| /** @type {string} */ | ||
| this.name = name; | ||
| /** @type {ExposesList} */ | ||
| this.exposes = exposes; | ||
| /** @type {string} */ | ||
| this.shareScope = shareScope; | ||
@@ -25,0 +28,0 @@ } |
@@ -55,4 +55,7 @@ /* | ||
| super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null); | ||
| /** @type {string} */ | ||
| this._name = name; | ||
| /** @type {ExposesList} */ | ||
| this._exposes = exposes; | ||
| /** @type {string} */ | ||
| this._shareScope = shareScope; | ||
@@ -59,0 +62,0 @@ } |
@@ -21,2 +21,3 @@ /* | ||
| super(request); | ||
| /** @type {string} */ | ||
| this.exposedName = exposedName; | ||
@@ -23,0 +24,0 @@ } |
@@ -21,2 +21,3 @@ /* | ||
| super(); | ||
| /** @type {ExternalRequests} */ | ||
| this.requests = requests; | ||
@@ -23,0 +24,0 @@ } |
@@ -16,2 +16,3 @@ /* | ||
| constructor(request) { | ||
| /** @type {string} */ | ||
| super(request); | ||
@@ -18,0 +19,0 @@ } |
@@ -48,3 +48,5 @@ /* | ||
| super(WEBPACK_MODULE_TYPE_FALLBACK); | ||
| /** @type {ExternalRequests} */ | ||
| this.requests = requests; | ||
| /** @type {string} */ | ||
| this._identifier = `fallback ${this.requests.join(" ")}`; | ||
@@ -51,0 +53,0 @@ } |
@@ -47,3 +47,3 @@ /* | ||
| validate(options); | ||
| /** @type {ModuleFederationPluginOptions} */ | ||
| this._options = options; | ||
@@ -50,0 +50,0 @@ } |
@@ -51,6 +51,11 @@ /* | ||
| super(WEBPACK_MODULE_TYPE_REMOTE); | ||
| /** @type {string} */ | ||
| this.request = request; | ||
| /** @type {ExternalRequests} */ | ||
| this.externalRequests = externalRequests; | ||
| /** @type {string} */ | ||
| this.internalRequest = internalRequest; | ||
| /** @type {string} */ | ||
| this.shareScope = shareScope; | ||
| /** @type {string} */ | ||
| this._identifier = `remote (${shareScope}) ${this.externalRequests.join( | ||
@@ -57,0 +62,0 @@ " " |
+12
-7
@@ -58,2 +58,3 @@ /* | ||
| constructor(fn, options) { | ||
| /** @type {GeneratorFn} */ | ||
| this.fn = fn; | ||
@@ -65,2 +66,3 @@ if (Array.isArray(options)) { | ||
| } | ||
| /** @type {true | RuntimeValueOptions} */ | ||
| this.options = options || {}; | ||
@@ -343,2 +345,4 @@ } | ||
| /** @typedef {Record<string, CodeValue>} Definitions */ | ||
| /** @type {WeakMap<Compilation, DefinePluginHooks>} */ | ||
@@ -365,5 +369,6 @@ const compilationHooksMap = new WeakMap(); | ||
| * Create a new define plugin | ||
| * @param {Record<string, CodeValue>} definitions A map of global object definitions | ||
| * @param {Definitions} definitions A map of global object definitions | ||
| */ | ||
| constructor(definitions) { | ||
| /** @type {Definitions} */ | ||
| this.definitions = definitions; | ||
@@ -471,3 +476,3 @@ } | ||
| * Walk definitions | ||
| * @param {Record<string, CodeValue>} definitions Definitions map | ||
| * @param {Definitions} definitions Definitions map | ||
| * @param {string} prefix Prefix string | ||
@@ -486,3 +491,3 @@ * @returns {void} | ||
| walkDefinitions( | ||
| /** @type {Record<string, CodeValue>} */ (code), | ||
| /** @type {Definitions} */ (code), | ||
| `${prefix + key}.` | ||
@@ -546,3 +551,3 @@ ); | ||
| } | ||
| /** @type {Record<string, CodeValue>} */ | ||
| /** @type {Definitions} */ | ||
| const obj = Object.create(null); | ||
@@ -794,3 +799,3 @@ const finalSet = finalByNestedKey.get(nested); | ||
| * Walk definitions | ||
| * @param {Record<string, CodeValue>} definitions Definitions map | ||
| * @param {Definitions} definitions Definitions map | ||
| * @param {string} prefix Prefix string | ||
@@ -823,3 +828,3 @@ * @returns {void} | ||
| walkDefinitionsForValues( | ||
| /** @type {Record<string, CodeValue>} */ (code), | ||
| /** @type {Definitions} */ (code), | ||
| `${prefix + key}.` | ||
@@ -832,3 +837,3 @@ ); | ||
| /** | ||
| * @param {Record<string, CodeValue>} definitions Definitions map | ||
| * @param {Definitions} definitions Definitions map | ||
| * @returns {void} | ||
@@ -835,0 +840,0 @@ */ |
@@ -40,2 +40,4 @@ /* | ||
| /** @typedef {(name: string) => string} ExportsConventionFn */ | ||
| /** | ||
@@ -42,0 +44,0 @@ * @param {string} local css local |
@@ -9,2 +9,3 @@ /* | ||
| const makeSerializable = require("../util/makeSerializable"); | ||
| const { ExportPresenceModes } = require("./HarmonyImportDependency"); | ||
| const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency"); | ||
@@ -48,3 +49,3 @@ const { ImportPhase } = require("./ImportPhase"); | ||
| range, | ||
| false, | ||
| ExportPresenceModes.NONE, | ||
| ImportPhase.Evaluation, | ||
@@ -51,0 +52,0 @@ attributes, |
@@ -32,3 +32,3 @@ /* | ||
| /** @typedef {0 | 1 | 2 | 3 | false} ExportPresenceMode */ | ||
| /** @typedef {0 | 1 | 2 | 3} ExportPresenceMode */ | ||
@@ -35,0 +35,0 @@ const ExportPresenceModes = { |
@@ -84,2 +84,3 @@ /* | ||
| this.options = options; | ||
| /** @type {ExportPresenceMode} */ | ||
| this.exportPresenceMode = | ||
@@ -111,3 +112,3 @@ options.importExportsPresence !== undefined | ||
| return data && data.guards && data.guards.has(getMembersKey(ids)) | ||
| ? false | ||
| ? ExportPresenceModes.NONE | ||
| : this.exportPresenceMode; | ||
@@ -656,13 +657,15 @@ } | ||
| parser.hooks.collectGuards.tap(PLUGIN_NAME, (expression) => { | ||
| if (parser.scope.isAsmJs) return; | ||
| /** @type {Guards} */ | ||
| const guards = new Map(); | ||
| collect(expression, guards, true); | ||
| if (this.exportPresenceMode !== ExportPresenceModes.NONE) { | ||
| parser.hooks.collectGuards.tap(PLUGIN_NAME, (expression) => { | ||
| if (parser.scope.isAsmJs) return; | ||
| /** @type {Guards} */ | ||
| const guards = new Map(); | ||
| collect(expression, guards, true); | ||
| if (guards.size === 0) return; | ||
| return (walk) => { | ||
| withGuards(guards, walk); | ||
| }; | ||
| }); | ||
| if (guards.size === 0) return; | ||
| return (walk) => { | ||
| withGuards(guards, walk); | ||
| }; | ||
| }); | ||
| } | ||
| } | ||
@@ -669,0 +672,0 @@ }; |
@@ -16,3 +16,3 @@ /* | ||
| /** | ||
| * @param {GroupOptions | null} chunkName chunk name | ||
| * @param {GroupOptions | string | null} chunkName chunk name | ||
| * @param {(DependencyLocation | null)=} loc location info | ||
@@ -19,0 +19,0 @@ */ |
@@ -13,3 +13,4 @@ /* | ||
| /** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescriptionNormalized */ | ||
| /** @typedef {import("../declarations/WebpackOptions").EntryDynamicNormalized} EntryDynamic */ | ||
| /** @typedef {import("../declarations/WebpackOptions").EntryStatic} EntryStatic */ | ||
| /** @typedef {import("../declarations/WebpackOptions").EntryStaticNormalized} EntryStaticNormalized */ | ||
| /** @typedef {import("./Compiler")} Compiler */ | ||
@@ -19,2 +20,5 @@ | ||
| /** @typedef {() => EntryStatic | Promise<EntryStatic>} RawEntryDynamic */ | ||
| /** @typedef {() => Promise<EntryStaticNormalized>} EntryDynamic */ | ||
| class DynamicEntryPlugin { | ||
@@ -26,3 +30,5 @@ /** | ||
| constructor(context, entry) { | ||
| /** @type {string} */ | ||
| this.context = context; | ||
| /** @type {EntryDynamic} */ | ||
| this.entry = entry; | ||
@@ -29,0 +35,0 @@ } |
@@ -11,8 +11,10 @@ /* | ||
| /** @typedef {import("../Compiler")} Compiler */ | ||
| /** @typedef {"main" | "preload" | "renderer"} ElectronContext */ | ||
| class ElectronTargetPlugin { | ||
| /** | ||
| * @param {"main" | "preload" | "renderer"=} context in main, preload or renderer context? | ||
| * @param {ElectronContext=} context in main, preload or renderer context? | ||
| */ | ||
| constructor(context) { | ||
| /** @type {ElectronContext | undefined} */ | ||
| this._context = context; | ||
@@ -19,0 +21,0 @@ } |
@@ -20,2 +20,3 @@ /* | ||
| /** @typedef {import("../declarations/WebpackOptions").ExternalsType} ExternalsType */ | ||
| /** @typedef {import("../declarations/WebpackOptions").ExternalItem} ExternalItem */ | ||
| /** @typedef {import("../declarations/WebpackOptions").ExternalItemValue} ExternalItemValue */ | ||
@@ -25,2 +26,3 @@ /** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectKnown} ExternalItemObjectKnown */ | ||
| /** @typedef {import("../declarations/WebpackOptions").Externals} Externals */ | ||
| /** @typedef {import("./Dependency")} Dependency */ | ||
| /** @typedef {import("./ExternalModule").DependencyMeta} DependencyMeta */ | ||
@@ -66,2 +68,3 @@ /** @typedef {import("./ModuleFactory").IssuerLayer} IssuerLayer */ | ||
| /** @typedef {(layer: string | null) => ExternalItem} ExternalItemByLayerFn */ | ||
| /** @typedef {ExternalItemObjectKnown & ExternalItemObjectUnknown} ExternalItemObject */ | ||
@@ -102,3 +105,3 @@ | ||
| /** | ||
| * @param {ExternalsType} type default external type | ||
| * @param {ExternalsType | ((dependency: Dependency) => ExternalsType)} type default external type | ||
| * @param {Externals} externals externals config | ||
@@ -166,3 +169,7 @@ */ | ||
| const resolvedType = type || globalType; | ||
| const defaultType = | ||
| typeof globalType === "function" | ||
| ? globalType(dependency) | ||
| : globalType; | ||
| const resolvedType = type || defaultType; | ||
@@ -169,0 +176,0 @@ // TODO make it pluggable/add hooks to `ExternalModule` to allow output modules own externals? |
@@ -16,2 +16,3 @@ /* | ||
| /** @typedef {import("./ExternalModule").Imported} Imported */ | ||
| /** @typedef {import("./Dependency")} Dependency */ | ||
@@ -22,3 +23,3 @@ const PLUGIN_NAME = "ExternalsPlugin"; | ||
| /** | ||
| * @param {ExternalsType} type default external type | ||
| * @param {ExternalsType | ((dependency: Dependency) => ExternalsType)} type default external type | ||
| * @param {Externals} externals externals config | ||
@@ -25,0 +26,0 @@ */ |
@@ -33,2 +33,3 @@ /* | ||
| constructor(options) { | ||
| /** @type {ChunkModuleIdRangePluginOptions} */ | ||
| this.options = options; | ||
@@ -43,3 +44,2 @@ } | ||
| apply(compiler) { | ||
| const options = this.options; | ||
| compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { | ||
@@ -51,7 +51,7 @@ const moduleGraph = compilation.moduleGraph; | ||
| compilation.chunks, | ||
| (chunk) => chunk.name === options.name | ||
| (chunk) => chunk.name === this.options.name | ||
| ); | ||
| if (!chunk) { | ||
| throw new Error( | ||
| `${PLUGIN_NAME}: Chunk with name '${options.name}"' was not found` | ||
| `${PLUGIN_NAME}: Chunk with name '${this.options.name}"' was not found` | ||
| ); | ||
@@ -62,6 +62,6 @@ } | ||
| let chunkModules; | ||
| if (options.order) { | ||
| if (this.options.order) { | ||
| /** @type {ModuleComparator} */ | ||
| let cmpFn; | ||
| switch (options.order) { | ||
| switch (this.options.order) { | ||
| case "index": | ||
@@ -85,3 +85,3 @@ case "preOrderIndex": | ||
| let currentId = options.start || 0; | ||
| let currentId = this.options.start || 0; | ||
| for (let i = 0; i < chunkModules.length; i++) { | ||
@@ -92,3 +92,3 @@ const m = chunkModules[i]; | ||
| } | ||
| if (options.end && currentId > options.end) break; | ||
| if (this.options.end && currentId > this.options.end) break; | ||
| } | ||
@@ -95,0 +95,0 @@ }); |
@@ -30,2 +30,3 @@ /* | ||
| constructor(options = {}) { | ||
| /** @type {DeterministicChunkIdsPluginOptions} */ | ||
| this.options = options; | ||
@@ -32,0 +33,0 @@ } |
@@ -37,2 +37,3 @@ /* | ||
| constructor(options = {}) { | ||
| /** @type {DeterministicModuleIdsPluginOptions} */ | ||
| this.options = options; | ||
@@ -39,0 +40,0 @@ } |
@@ -56,3 +56,2 @@ /* | ||
| apply(compiler) { | ||
| const options = this.options; | ||
| compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { | ||
@@ -71,10 +70,6 @@ compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => { | ||
| const ident = getFullModuleName(module, context, compiler.root); | ||
| const hash = createHash( | ||
| /** @type {NonNullable<HashedModuleIdsPluginOptions["hashFunction"]>} */ ( | ||
| options.hashFunction | ||
| ) | ||
| ); | ||
| const hash = createHash(this.options.hashFunction); | ||
| hash.update(ident || ""); | ||
| const hashId = hash.digest(options.hashDigest); | ||
| let len = options.hashDigestLength; | ||
| const hashId = hash.digest(this.options.hashDigest); | ||
| let len = this.options.hashDigestLength; | ||
| while (usedIds.has(hashId.slice(0, len))) { | ||
@@ -81,0 +76,0 @@ /** @type {number} */ (len)++; |
@@ -31,5 +31,5 @@ /* | ||
| */ | ||
| constructor(options) { | ||
| this.delimiter = (options && options.delimiter) || "-"; | ||
| this.context = options && options.context; | ||
| constructor(options = {}) { | ||
| /** @type {NamedChunkIdsPluginOptions} */ | ||
| this.options = options; | ||
| } | ||
@@ -47,4 +47,6 @@ | ||
| const chunkGraph = compilation.chunkGraph; | ||
| const context = this.context ? this.context : compiler.context; | ||
| const delimiter = this.delimiter; | ||
| const context = this.options.context | ||
| ? this.options.context | ||
| : compiler.context; | ||
| const delimiter = this.options.delimiter || "-"; | ||
@@ -51,0 +53,0 @@ const unnamedChunks = assignNames( |
@@ -31,2 +31,3 @@ /* | ||
| constructor(options = {}) { | ||
| /** @type {NamedModuleIdsPluginOptions} */ | ||
| this.options = options; | ||
@@ -33,0 +34,0 @@ } |
@@ -33,2 +33,3 @@ /* | ||
| validate(options); | ||
| /** @type {OccurrenceChunkIdsPluginOptions} */ | ||
| this.options = options; | ||
@@ -43,3 +44,2 @@ } | ||
| apply(compiler) { | ||
| const prioritiseInitial = this.options.prioritiseInitial; | ||
| compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { | ||
@@ -66,3 +66,3 @@ compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => { | ||
| const chunksInOccurrenceOrder = [...chunks].sort((a, b) => { | ||
| if (prioritiseInitial) { | ||
| if (this.options.prioritiseInitial) { | ||
| const aEntryOccurs = | ||
@@ -69,0 +69,0 @@ /** @type {number} */ |
@@ -38,2 +38,3 @@ /* | ||
| validate(options); | ||
| /** @type {OccurrenceModuleIdsPluginOptions} */ | ||
| this.options = options; | ||
@@ -48,3 +49,2 @@ } | ||
| apply(compiler) { | ||
| const prioritiseInitial = this.options.prioritiseInitial; | ||
| compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { | ||
@@ -120,3 +120,3 @@ const moduleGraph = compilation.moduleGraph; | ||
| if (prioritiseInitial) { | ||
| if (this.options.prioritiseInitial) { | ||
| for (const m of modulesInOccurrenceOrder) { | ||
@@ -144,3 +144,3 @@ const result = | ||
| modulesInOccurrenceOrder.sort((a, b) => { | ||
| if (prioritiseInitial) { | ||
| if (this.options.prioritiseInitial) { | ||
| const aEntryOccurs = | ||
@@ -147,0 +147,0 @@ /** @type {number} */ |
@@ -32,10 +32,5 @@ /* | ||
| */ | ||
| constructor({ path, context, test, mode }) { | ||
| this._path = path; | ||
| this._context = context; | ||
| this._test = test || (() => true); | ||
| const readAndWrite = !mode || mode === "merge" || mode === "update"; | ||
| this._read = readAndWrite || mode === "read"; | ||
| this._write = readAndWrite || mode === "create"; | ||
| this._prune = mode === "update"; | ||
| constructor(options) { | ||
| /** @type {SyncModuleIdsPluginOptions} */ | ||
| this.options = options; | ||
| } | ||
@@ -52,3 +47,13 @@ | ||
| let dataChanged = false; | ||
| if (this._read) { | ||
| const readAndWrite = | ||
| !this.options.mode || | ||
| this.options.mode === "merge" || | ||
| this.options.mode === "update"; | ||
| const needRead = readAndWrite || this.options.mode === "read"; | ||
| const needWrite = readAndWrite || this.options.mode === "create"; | ||
| const needPrune = this.options.mode === "update"; | ||
| if (needRead) { | ||
| compiler.hooks.readRecords.tapAsync(plugin, (callback) => { | ||
@@ -58,3 +63,3 @@ const fs = | ||
| (compiler.intermediateFileSystem); | ||
| fs.readFile(this._path, (err, buffer) => { | ||
| fs.readFile(this.options.path, (err, buffer) => { | ||
| if (err) { | ||
@@ -78,3 +83,3 @@ if (err.code !== "ENOENT") { | ||
| } | ||
| if (this._write) { | ||
| if (needWrite) { | ||
| compiler.hooks.emitRecords.tapAsync(plugin, (callback) => { | ||
@@ -91,3 +96,3 @@ if (!data || !dataChanged) return callback(); | ||
| (compiler.intermediateFileSystem); | ||
| fs.writeFile(this._path, JSON.stringify(json), callback); | ||
| fs.writeFile(this.options.path, JSON.stringify(json), callback); | ||
| }); | ||
@@ -97,4 +102,5 @@ } | ||
| const associatedObjectForCache = compiler.root; | ||
| const context = this._context || compiler.context; | ||
| if (this._read) { | ||
| const context = this.options.context || compiler.context; | ||
| const test = this.options.test || (() => true); | ||
| if (needRead) { | ||
| compilation.hooks.reviveModules.tap(plugin, (_1, _2) => { | ||
@@ -105,3 +111,3 @@ if (!data) return; | ||
| compilation, | ||
| this._test | ||
| test | ||
| ); | ||
@@ -118,3 +124,3 @@ for (const module of modules) { | ||
| const err = new WebpackError( | ||
| `SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this._path}' as it's already used.` | ||
| `SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this.options.path}' as it's already used.` | ||
| ); | ||
@@ -129,3 +135,3 @@ err.module = module; | ||
| } | ||
| if (this._write) { | ||
| if (needWrite) { | ||
| compilation.hooks.recordModules.tap(plugin, (modules) => { | ||
@@ -136,7 +142,7 @@ const { chunkGraph } = compilation; | ||
| oldData = data = new Map(); | ||
| } else if (this._prune) { | ||
| } else if (needPrune) { | ||
| data = new Map(); | ||
| } | ||
| for (const module of modules) { | ||
| if (this._test(module)) { | ||
| if (test(module)) { | ||
| const name = module.libIdent({ | ||
@@ -143,0 +149,0 @@ context, |
@@ -8,5 +8,7 @@ /* | ||
| /** @typedef {import("../declarations/WebpackOptions").IgnoreWarningsNormalized} IgnoreWarningsNormalized */ | ||
| /** @typedef {import("./Compiler")} Compiler */ | ||
| /** @typedef {import("./Compilation")} Compilation */ | ||
| /** @typedef {(warning: Error, compilation: Compilation) => boolean} IgnoreFn */ | ||
| const PLUGIN_NAME = "IgnoreWarningsPlugin"; | ||
@@ -16,5 +18,6 @@ | ||
| /** | ||
| * @param {IgnoreWarningsNormalized} ignoreWarnings conditions to ignore warnings | ||
| * @param {IgnoreFn[]} ignoreWarnings conditions to ignore warnings | ||
| */ | ||
| constructor(ignoreWarnings) { | ||
| /** @type {IgnoreFn[]} */ | ||
| this._ignoreWarnings = ignoreWarnings; | ||
@@ -21,0 +24,0 @@ } |
+2
-2
@@ -36,4 +36,4 @@ /* | ||
| /** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */ | ||
| /** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ | ||
| /** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */ | ||
| /** @typedef {import("./webpack").WebpackPluginFunction} WebpackPluginFunction */ | ||
| /** @typedef {import("./webpack").WebpackPluginInstance} WebpackPluginInstance */ | ||
| /** @typedef {import("./ChunkGroup")} ChunkGroup */ | ||
@@ -40,0 +40,0 @@ /** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */ |
@@ -128,2 +128,3 @@ /* | ||
| super(); | ||
| /** @type {JsonGeneratorOptions} */ | ||
| this.options = options; | ||
@@ -130,0 +131,0 @@ } |
@@ -34,5 +34,6 @@ /* | ||
| */ | ||
| constructor(options) { | ||
| constructor(options = {}) { | ||
| super(); | ||
| this.options = options || {}; | ||
| /** @type {JsonModulesPluginParserOptions} */ | ||
| this.options = options; | ||
| } | ||
@@ -39,0 +40,0 @@ |
@@ -103,3 +103,4 @@ /* | ||
| /** | ||
| * @returns {[string?, ...EXPECTED_ANY]} labeled args | ||
| * @template T | ||
| * @returns {[string?, ...T[]]} labeled args | ||
| */ | ||
@@ -106,0 +107,0 @@ const labeledArgs = () => { |
@@ -40,10 +40,14 @@ /* | ||
| /** @typedef {EXPECTED_ANY[]} Args */ | ||
| /** @typedef {(type: LogTypeEnum, args?: Args) => void} LogFn */ | ||
| /** @typedef {(name: string | (() => string)) => WebpackLogger} GetChildLogger */ | ||
| class WebpackLogger { | ||
| /** | ||
| * @param {(type: LogTypeEnum, args?: Args) => void} log log function | ||
| * @param {(name: string | (() => string)) => WebpackLogger} getChildLogger function to create child logger | ||
| * @param {LogFn} log log function | ||
| * @param {GetChildLogger} getChildLogger function to create child logger | ||
| */ | ||
| constructor(log, getChildLogger) { | ||
| /** @type {LogFn} */ | ||
| this[LOG_SYMBOL] = log; | ||
| /** @type {GetChildLogger} */ | ||
| this.getChildLogger = getChildLogger; | ||
@@ -88,7 +92,7 @@ } | ||
| /** | ||
| * @param {EXPECTED_ANY} assertion assertion | ||
| * @param {boolean=} condition condition | ||
| * @param {Args} args args | ||
| */ | ||
| assert(assertion, ...args) { | ||
| if (!assertion) { | ||
| assert(condition, ...args) { | ||
| if (!condition) { | ||
| this[LOG_SYMBOL](LogType.error, args); | ||
@@ -95,0 +99,0 @@ } |
@@ -25,2 +25,6 @@ /* | ||
| /** @typedef {(item: ManifestItem) => boolean} Filter */ | ||
| /** @typedef {(manifest: ManifestObject) => ManifestObject} Generate */ | ||
| /** @typedef {(manifest: ManifestObject) => string} Serialize */ | ||
| const PLUGIN_NAME = "ManifestPlugin"; | ||
@@ -27,0 +31,0 @@ |
@@ -35,3 +35,5 @@ /* | ||
| this.name = "ModuleError"; | ||
| /** @type {Error} */ | ||
| this.error = err; | ||
| /** @type {string | undefined} */ | ||
| this.details = | ||
@@ -38,0 +40,0 @@ err && typeof err === "object" && err.stack |
@@ -18,3 +18,4 @@ /* | ||
| /** @typedef {string | RegExp | ((str: string) => boolean) | (string | RegExp | ((str: string) => boolean))[]} Matcher */ | ||
| /** @typedef {(str: string) => boolean} MatcherFn */ | ||
| /** @typedef {string | RegExp | MatcherFn | (string | RegExp | MatcherFn)[]} Matcher */ | ||
| /** @typedef {{ test?: Matcher, include?: Matcher, exclude?: Matcher }} MatchObject */ | ||
@@ -21,0 +22,0 @@ |
@@ -27,3 +27,4 @@ /* | ||
| constructor(options = {}) { | ||
| this._asyncChunkLoading = options.asyncChunkLoading; | ||
| /** @type {CommonJsChunkLoadingPluginOptions} */ | ||
| this.options = options; | ||
| } | ||
@@ -37,6 +38,6 @@ | ||
| apply(compiler) { | ||
| const ChunkLoadingRuntimeModule = this._asyncChunkLoading | ||
| const ChunkLoadingRuntimeModule = this.options.asyncChunkLoading | ||
| ? require("./ReadFileChunkLoadingRuntimeModule") | ||
| : require("./RequireChunkLoadingRuntimeModule"); | ||
| const chunkLoadingValue = this._asyncChunkLoading | ||
| const chunkLoadingValue = this.options.asyncChunkLoading | ||
| ? "async-node" | ||
@@ -46,3 +47,3 @@ : "require"; | ||
| chunkLoading: chunkLoadingValue, | ||
| asyncChunkLoading: this._asyncChunkLoading | ||
| asyncChunkLoading: this.options.asyncChunkLoading | ||
| }).apply(compiler); | ||
@@ -49,0 +50,0 @@ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { |
@@ -30,2 +30,3 @@ /* | ||
| constructor(options) { | ||
| /** @type {NodeEnvironmentPluginOptions} */ | ||
| this.options = options; | ||
@@ -32,0 +33,0 @@ } |
@@ -90,3 +90,11 @@ /* | ||
| apply(compiler) { | ||
| new ExternalsPlugin(this.type, builtins).apply(compiler); | ||
| new ExternalsPlugin((dependency) => { | ||
| // When `require` node.js built-in modules with module output | ||
| // we should still emit `createRequire` for compatibility | ||
| if (dependency.category === "commonjs") { | ||
| return "node-commonjs"; | ||
| } | ||
| return this.type; | ||
| }, builtins).apply(compiler); | ||
| } | ||
@@ -93,0 +101,0 @@ } |
@@ -23,2 +23,3 @@ /* | ||
| constructor(options = {}) { | ||
| /** @type {NodeTemplatePluginOptions} */ | ||
| this._options = options; | ||
@@ -25,0 +26,0 @@ } |
@@ -12,2 +12,3 @@ /* | ||
| /** @typedef {import("watchpack").TimeInfoEntries} TimeInfoEntries */ | ||
| /** @typedef {import("watchpack").WatchOptions} WatchOptions */ | ||
| /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ | ||
@@ -23,3 +24,5 @@ /** @typedef {import("../util/fs").WatchMethod} WatchMethod */ | ||
| constructor(inputFileSystem) { | ||
| /** @type {InputFileSystem} */ | ||
| this.inputFileSystem = inputFileSystem; | ||
| /** @type {WatchOptions} */ | ||
| this.watcherOptions = { | ||
@@ -26,0 +29,0 @@ aggregateTimeout: 0 |
@@ -33,2 +33,3 @@ /* | ||
| super("readFile chunk loading", RuntimeModule.STAGE_ATTACH); | ||
| /** @type {ReadOnlyRuntimeRequirements} */ | ||
| this.runtimeRequirements = runtimeRequirements; | ||
@@ -35,0 +36,0 @@ } |
@@ -28,2 +28,3 @@ /* | ||
| constructor({ import: useImport = false } = {}) { | ||
| /** @type {boolean} */ | ||
| this._import = useImport; | ||
@@ -30,0 +31,0 @@ } |
@@ -29,2 +29,3 @@ /* | ||
| constructor(options = {}) { | ||
| /** @type {ReadFileCompileWasmPluginOptions} */ | ||
| this.options = options; | ||
@@ -31,0 +32,0 @@ } |
@@ -33,2 +33,3 @@ /* | ||
| super("require chunk loading", RuntimeModule.STAGE_ATTACH); | ||
| /** @type {ReadOnlyRuntimeRequirements} */ | ||
| this.runtimeRequirements = runtimeRequirements; | ||
@@ -35,0 +36,0 @@ } |
@@ -119,2 +119,4 @@ /* | ||
| /** @typedef {(content: string) => boolean} NoParseFn */ | ||
| const getInvalidDependenciesModuleWarning = memoize(() => | ||
@@ -121,0 +123,0 @@ require("./InvalidDependenciesModuleWarning") |
@@ -67,12 +67,17 @@ /* | ||
| /** @type {AggressiveSplittingPluginOptions} */ | ||
| this.options = options; | ||
| if (typeof this.options.minSize !== "number") { | ||
| this.options.minSize = 30 * 1024; | ||
| } | ||
| if (typeof this.options.maxSize !== "number") { | ||
| this.options.maxSize = 50 * 1024; | ||
| } | ||
| if (typeof this.options.chunkOverhead !== "number") { | ||
| this.options.chunkOverhead = 0; | ||
| } | ||
| if (typeof this.options.entryChunkMultiplicator !== "number") { | ||
@@ -79,0 +84,0 @@ this.options.entryChunkMultiplicator = 1; |
@@ -60,5 +60,6 @@ /* | ||
| */ | ||
| constructor(options) { | ||
| constructor(options = { maxChunks: 1 }) { | ||
| validate(options); | ||
| this.options = /** @type {LimitChunkCountPluginOptions} */ (options); | ||
| /** @type {LimitChunkCountPluginOptions} */ | ||
| this.options = options; | ||
| } | ||
@@ -65,0 +66,0 @@ |
@@ -30,6 +30,7 @@ /* | ||
| /** | ||
| * @param {MergeDuplicateChunksPluginOptions} options options object | ||
| * @param {MergeDuplicateChunksPluginOptions=} options options object | ||
| */ | ||
| constructor(options = { stage: STAGE_BASIC }) { | ||
| validate(options); | ||
| /** @type {MergeDuplicateChunksPluginOptions} */ | ||
| this.options = options; | ||
@@ -36,0 +37,0 @@ } |
@@ -151,3 +151,5 @@ /* | ||
| constructor({ hashFunction, hashDigest }) { | ||
| /** @type {HashFunction} */ | ||
| this._hashFunction = hashFunction; | ||
| /** @type {HashDigest} */ | ||
| this._hashDigest = hashDigest; | ||
@@ -154,0 +156,0 @@ } |
@@ -19,5 +19,5 @@ /* | ||
| */ | ||
| constructor(options) { | ||
| constructor(options = {}) { | ||
| /** @type {{ name: string | RuntimeChunkFunction }} */ | ||
| this.options = { | ||
| /** @type {RuntimeChunkFunction} */ | ||
| name: (entrypoint) => `runtime~${entrypoint.name}`, | ||
@@ -42,5 +42,3 @@ ...options | ||
| // Determine runtime chunk name | ||
| let name = | ||
| /** @type {string | RuntimeChunkFunction} */ | ||
| (this.options.name); | ||
| let name = this.options.name; | ||
| if (typeof name === "function") { | ||
@@ -47,0 +45,0 @@ name = name({ name: entryName }); |
@@ -25,3 +25,2 @@ /* | ||
| /** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksCacheGroup} OptimizationSplitChunksCacheGroup */ | ||
| /** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksGetCacheGroups} OptimizationSplitChunksGetCacheGroups */ | ||
| /** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksOptions} OptimizationSplitChunksOptions */ | ||
@@ -128,2 +127,4 @@ /** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksSizes} OptimizationSplitChunksSizes */ | ||
| /** @typedef {(module: Module) => OptimizationSplitChunksCacheGroup | OptimizationSplitChunksCacheGroup[] | void} RawGetCacheGroups */ | ||
| /** | ||
@@ -461,3 +462,3 @@ * @callback GetCacheGroups | ||
| /** | ||
| * @param {undefined | GetCacheGroups | Record<string, false | string | RegExp | OptimizationSplitChunksGetCacheGroups | OptimizationSplitChunksCacheGroup>} cacheGroups the cache group options | ||
| * @param {undefined | GetCacheGroups | Record<string, false | string | RegExp | RawGetCacheGroups | OptimizationSplitChunksCacheGroup>} cacheGroups the cache group options | ||
| * @param {DefaultSizeTypes} defaultSizeTypes the default size types | ||
@@ -539,2 +540,4 @@ * @returns {GetCacheGroups} a function to get the cache groups | ||
| /** @typedef {(module: Module, context: CacheGroupsContext) => boolean} CheckTestFn */ | ||
| /** | ||
@@ -563,2 +566,4 @@ * @param {OptimizationSplitChunksCacheGroup["test"]} test test option | ||
| /** @typedef {(type: string) => boolean} CheckModuleTypeFn */ | ||
| /** | ||
@@ -585,2 +590,4 @@ * @param {OptimizationSplitChunksCacheGroup["type"]} test type option | ||
| /** @typedef {(layer: string | null) => boolean} CheckModuleLayerFn */ | ||
| /** | ||
@@ -587,0 +594,0 @@ * @param {OptimizationSplitChunksCacheGroup["layer"]} test type option |
@@ -37,8 +37,5 @@ /* | ||
| /** | ||
| * @param {Asset["name"]} name the name | ||
| * @param {Asset["source"]} source the source | ||
| * @param {Asset["info"]} info the info | ||
| * @returns {boolean} result | ||
| */ | ||
| /** @typedef {(name: Asset["name"], source: Asset["source"], assetInfo: Asset["info"]) => boolean} AssetFilter */ | ||
| /** @type {AssetFilter} */ | ||
| const excludeSourceMap = (name, source, info) => !info.development; | ||
@@ -54,4 +51,7 @@ | ||
| this.hints = options.hints; | ||
| /** @type {number | undefined} */ | ||
| this.maxAssetSize = options.maxAssetSize; | ||
| /** @type {number | undefined} */ | ||
| this.maxEntrypointSize = options.maxEntrypointSize; | ||
| /** @type {AssetFilter | undefined} */ | ||
| this.assetFilter = options.assetFilter; | ||
@@ -58,0 +58,0 @@ } |
@@ -20,3 +20,5 @@ /* | ||
| super(`chunk ${type} function`); | ||
| /** @type {string} */ | ||
| this.runtimeFunction = runtimeFunction; | ||
| /** @type {string} */ | ||
| this.runtimeHandlers = runtimeHandlers; | ||
@@ -23,0 +25,0 @@ } |
@@ -12,2 +12,3 @@ /* | ||
| /** @typedef {import("../Chunk")} Chunk */ | ||
| /** @typedef {import("../Chunk").ChunkChildOfTypeInOrder} ChunkChildOfTypeInOrder */ | ||
| /** @typedef {import("../Compilation")} Compilation */ | ||
@@ -17,6 +18,7 @@ | ||
| /** | ||
| * @param {{ onChunks: Chunk[], chunks: Set<Chunk> }[]} startupChunks chunk ids to trigger when chunks are loaded | ||
| * @param {ChunkChildOfTypeInOrder[]} startupChunks chunk ids to trigger when chunks are loaded | ||
| */ | ||
| constructor(startupChunks) { | ||
| super("startup prefetch", RuntimeModule.STAGE_TRIGGER); | ||
| /** @type {ChunkChildOfTypeInOrder[]} */ | ||
| this.startupChunks = startupChunks; | ||
@@ -23,0 +25,0 @@ } |
@@ -20,2 +20,3 @@ /* | ||
| super("chunk prefetch trigger", RuntimeModule.STAGE_TRIGGER); | ||
| /** @type {ChunkChildIdsByOrdersMap} */ | ||
| this.chunkMap = chunkMap; | ||
@@ -22,0 +23,0 @@ } |
@@ -20,2 +20,3 @@ /* | ||
| super("chunk preload trigger", RuntimeModule.STAGE_TRIGGER); | ||
| /** @type {ChunkChildIdsByOrdersMap} */ | ||
| this.chunkMap = chunkMap; | ||
@@ -22,0 +23,0 @@ } |
@@ -12,2 +12,3 @@ /* | ||
| /** @typedef {import("../../declarations/WebpackOptions").Falsy} Falsy */ | ||
| /** @typedef {import("../../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */ | ||
| /** @typedef {import("../../declarations/WebpackOptions").RuleSetLoaderOptions} RuleSetLoaderOptions */ | ||
@@ -91,2 +92,5 @@ /** @typedef {import("../../declarations/WebpackOptions").RuleSetRule} RuleSetRule */ | ||
| /** @typedef {(data: EffectData) => (RuleSetUseItem | (Falsy | RuleSetUseItem)[])} RuleSetUseFn */ | ||
| /** @typedef {(value: string) => boolean} RuleSetConditionFn */ | ||
| /** @typedef {{ apply: (ruleSetCompiler: RuleSetCompiler) => void }} RuleSetPlugin */ | ||
@@ -93,0 +97,0 @@ |
@@ -33,2 +33,3 @@ /* | ||
| this.global = global; | ||
| /** @type {(chunk: Chunk) => TemplatePath | false} */ | ||
| this.getFilenameForChunk = getFilenameForChunk; | ||
@@ -35,0 +36,0 @@ /** @type {boolean} */ |
@@ -15,2 +15,3 @@ /* | ||
| super("getFullHash"); | ||
| /** @type {boolean} */ | ||
| this.fullHash = true; | ||
@@ -17,0 +18,0 @@ } |
@@ -106,2 +106,3 @@ /* | ||
| super("make deferred namespace object"); | ||
| /** @type {boolean} */ | ||
| this.hasAsyncRuntime = hasAsyncRuntime; | ||
@@ -108,0 +109,0 @@ } |
@@ -229,2 +229,3 @@ /* | ||
| constructor() { | ||
| /** @type {number} */ | ||
| this.version = 1; | ||
@@ -440,2 +441,4 @@ /** @type {Map<string, LockfileEntry | "ignore" | "no-cache">} */ | ||
| /** @typedef {(uri: string) => boolean} AllowedUriFn */ | ||
| const PLUGIN_NAME = "HttpUriPlugin"; | ||
@@ -449,8 +452,4 @@ | ||
| validate(options); | ||
| this._lockfileLocation = options.lockfileLocation; | ||
| this._cacheLocation = options.cacheLocation; | ||
| this._upgrade = options.upgrade; | ||
| this._frozen = options.frozen; | ||
| this._allowedUris = options.allowedUris; | ||
| this._proxy = options.proxy; | ||
| /** @type {HttpUriPluginOptions} */ | ||
| this.options = options; | ||
| } | ||
@@ -465,3 +464,3 @@ | ||
| const proxy = | ||
| this._proxy || process.env.http_proxy || process.env.HTTP_PROXY; | ||
| this.options.proxy || process.env.http_proxy || process.env.HTTP_PROXY; | ||
| /** | ||
@@ -493,3 +492,3 @@ * @type {{ scheme: "http" | "https", fetch: Fetch }[]} | ||
| const lockfileLocation = | ||
| this._lockfileLocation || | ||
| this.options.lockfileLocation || | ||
| join( | ||
@@ -504,11 +503,11 @@ intermediateFs, | ||
| const cacheLocation = | ||
| this._cacheLocation !== undefined | ||
| ? this._cacheLocation | ||
| this.options.cacheLocation !== undefined | ||
| ? this.options.cacheLocation | ||
| : `${lockfileLocation}.data`; | ||
| const upgrade = this._upgrade || false; | ||
| const frozen = this._frozen || false; | ||
| const upgrade = this.options.upgrade || false; | ||
| const frozen = this.options.frozen || false; | ||
| const hashFunction = "sha512"; | ||
| const hashDigest = "hex"; | ||
| const hashDigestLength = 20; | ||
| const allowedUris = this._allowedUris; | ||
| const allowedUris = this.options.allowedUris; | ||
@@ -515,0 +514,0 @@ let warnedAboutEol = false; |
@@ -129,2 +129,23 @@ /* | ||
| (compilation, { normalModuleFactory }) => { | ||
| compilation.hooks.assetPath.tap( | ||
| { name: PLUGIN_NAME, before: "TemplatedPathPlugin" }, | ||
| (path, data) => { | ||
| if (data.filename && this.modules[data.filename]) { | ||
| /** | ||
| * @param {string} str path | ||
| * @returns {string} safe path | ||
| */ | ||
| const toSafePath = (str) => | ||
| `__${str | ||
| .replace(/:/g, "__") | ||
| .replace(/^[^a-z0-9]+|[^a-z0-9]+$/gi, "") | ||
| .replace(/[^a-z0-9._-]+/gi, "_")}`; | ||
| // filename: virtual:logo.svg -> __virtual__logo.svg | ||
| data.filename = toSafePath(data.filename); | ||
| } | ||
| return path; | ||
| } | ||
| ); | ||
| normalModuleFactory.hooks.resolveForScheme | ||
@@ -131,0 +152,0 @@ .for(scheme) |
@@ -23,3 +23,5 @@ /* | ||
| this.name = "UnsupportedFeatureWarning"; | ||
| /** @type {DependencyLocation} */ | ||
| this.loc = loc; | ||
| /** @type {boolean} */ | ||
| this.hideStack = true; | ||
@@ -26,0 +28,0 @@ } |
@@ -96,2 +96,3 @@ /* | ||
| constructor(options) { | ||
| /** @type {JavascriptParserOptions} */ | ||
| this.options = options; | ||
@@ -98,0 +99,0 @@ } |
@@ -10,2 +10,3 @@ /* | ||
| const { digest, update } = require("./hash-digest"); | ||
| /** @type {number} */ | ||
| const MAX_SHORT_STRING = require("./wasm-hash").MAX_SHORT_STRING; | ||
@@ -12,0 +13,0 @@ |
@@ -41,2 +41,3 @@ /* | ||
| } | ||
| /** @type {string} */ | ||
| this.buffer = ""; | ||
@@ -43,0 +44,0 @@ } |
@@ -230,3 +230,4 @@ /* | ||
| create.MAX_SHORT_STRING = MAX_SHORT_STRING; | ||
| module.exports = create; | ||
| module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; |
@@ -35,2 +35,3 @@ /* | ||
| constructor(type) { | ||
| /** @type {WasmLoadingType} */ | ||
| this.type = type; | ||
@@ -37,0 +38,0 @@ } |
+3
-1
@@ -26,3 +26,2 @@ /* | ||
| /** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ | ||
| /** @typedef {import("./config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptionsNormalizedWithDefaults */ | ||
@@ -36,2 +35,5 @@ /** @typedef {import("./config/normalization").WebpackOptionsInterception} WebpackOptionsInterception */ | ||
| /** @typedef {(this: Compiler, compiler: Compiler) => void} WebpackPluginFunction */ | ||
| /** @typedef {(compiler: Compiler) => void} WebpackPluginInstance */ | ||
| const getValidateSchema = memoize(() => require("./validateSchema")); | ||
@@ -38,0 +40,0 @@ |
@@ -77,3 +77,3 @@ /* | ||
| /** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */ | ||
| /** @typedef {import("./webpack").WebpackPluginFunction} WebpackPluginFunction */ | ||
| /** @typedef {import("./config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptions */ | ||
@@ -80,0 +80,0 @@ /** @typedef {import("./config/normalization").WebpackOptionsInterception} WebpackOptionsInterception */ |
@@ -33,3 +33,5 @@ /* | ||
| super("importScripts chunk loading", RuntimeModule.STAGE_ATTACH); | ||
| /** @type {ReadOnlyRuntimeRequirements} */ | ||
| this.runtimeRequirements = runtimeRequirements; | ||
| /** @type {boolean} */ | ||
| this._withCreateScriptUrl = withCreateScriptUrl; | ||
@@ -36,0 +38,0 @@ } |
+15
-10
| { | ||
| "name": "webpack", | ||
| "version": "5.105.0", | ||
| "version": "5.105.1", | ||
| "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", | ||
@@ -35,3 +35,3 @@ "homepage": "https://github.com/webpack/webpack", | ||
| "prelint": "yarn setup", | ||
| "lint": "yarn lint:code && yarn lint:special && yarn lint:types && yarn lint:types-test && yarn lint:types-benchmark && yarn lint:types-module-test && yarn lint:types-hot && yarn lint:yarn && yarn fmt:check && yarn lint:spellcheck", | ||
| "lint": "yarn lint:code && yarn lint:special && yarn lint:types && yarn lint:types-test && yarn lint:types-benchmark && yarn lint:types-module-test && yarn lint:types-hot && yarn fmt:check && yarn lint:spellcheck", | ||
| "lint:code": "node node_modules/eslint/bin/eslint.js --cache .", | ||
@@ -44,3 +44,2 @@ "lint:special": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals", | ||
| "lint:types-module-test": "tsc -p tsconfig.module.test.json", | ||
| "lint:yarn": "yarn-deduplicate --fail --list -s highest yarn.lock", | ||
| "lint:spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"", | ||
@@ -51,5 +50,4 @@ "validate:types": "tsc -p tsconfig.validation.json", | ||
| "fmt:base": "node node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .", | ||
| "fix": "yarn fix:code && yarn fix:yarn && yarn fix:special && yarn fmt", | ||
| "fix": "yarn fix:code && yarn fix:special && yarn fmt", | ||
| "fix:code": "yarn lint:code --fix", | ||
| "fix:yarn": "yarn-deduplicate -s highest yarn.lock", | ||
| "fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", | ||
@@ -122,3 +120,3 @@ "build:examples": "cd examples && node buildAll.js", | ||
| "@changesets/get-github-info": "^0.7.0", | ||
| "@codspeed/core": "^5.0.1", | ||
| "@codspeed/core": "^5.1.0", | ||
| "@types/glob-to-regexp": "^0.4.4", | ||
@@ -148,2 +146,3 @@ "@types/graceful-fs": "^4.1.9", | ||
| "hash-wasm": "^4.9.0", | ||
| "html-loader": "^5.1.0", | ||
| "husky": "^9.0.11", | ||
@@ -171,3 +170,3 @@ "istanbul": "^0.4.5", | ||
| "open-cli": "^8.0.0", | ||
| "pkg-pr-new": "^0.0.62", | ||
| "pkg-pr-new": "^0.0.63", | ||
| "prettier": "^3.7.4", | ||
@@ -181,2 +180,8 @@ "prettier-2": "npm:prettier@^2", | ||
| "react-dom": "^19.2.3", | ||
| "rehype-sanitize": "^6.0.0", | ||
| "rehype-stringify": "^10.0.1", | ||
| "remark-frontmatter": "^5.0.0", | ||
| "remark-gfm": "^4.0.1", | ||
| "remark-parse": "^11.0.0", | ||
| "remark-rehype": "^11.1.2", | ||
| "rimraf": "^3.0.2", | ||
@@ -191,5 +196,6 @@ "script-loader": "^0.7.2", | ||
| "toml": "^3.0.0", | ||
| "tooling": "webpack/tooling#v1.24.4", | ||
| "tooling": "webpack/tooling#v1.24.5", | ||
| "ts-loader": "^9.5.4", | ||
| "typescript": "^5.9.3", | ||
| "unified": "^11.0.5", | ||
| "url-loader": "^4.1.0", | ||
@@ -200,4 +206,3 @@ "wast-loader": "^1.12.1", | ||
| "xxhashjs": "^0.2.2", | ||
| "yamljs": "^0.3.0", | ||
| "yarn-deduplicate": "^6.0.1" | ||
| "yamljs": "^0.3.0" | ||
| }, | ||
@@ -204,0 +209,0 @@ "peerDependenciesMeta": { |
@@ -6,3 +6,3 @@ { | ||
| "instanceof": "Function", | ||
| "tsType": "(data: { hash?: string, chunk: import('../../lib/Chunk'), filename: string }) => string" | ||
| "tsType": "import('../../lib/BannerPlugin').BannerFunction" | ||
| }, | ||
@@ -22,3 +22,3 @@ "Rule": { | ||
| "instanceof": "Function", | ||
| "tsType": "((str: string) => boolean)" | ||
| "tsType": "import('../../lib/ModuleFilenameHelpers').MatcherFn" | ||
| } | ||
@@ -25,0 +25,0 @@ ] |
@@ -28,3 +28,3 @@ { | ||
| "instanceof": "Function", | ||
| "tsType": "(import(\"../../lib/IgnorePlugin\").CheckResourceFn)" | ||
| "tsType": "import('../../lib/IgnorePlugin').CheckResourceFn" | ||
| } | ||
@@ -31,0 +31,0 @@ }, |
@@ -81,3 +81,3 @@ { | ||
| "instanceof": "Function", | ||
| "tsType": "(item: ManifestItem) => boolean" | ||
| "tsType": "import('../../lib/ManifestPlugin').Filter" | ||
| }, | ||
@@ -87,3 +87,3 @@ "generate": { | ||
| "instanceof": "Function", | ||
| "tsType": "(manifest: ManifestObject) => ManifestObject" | ||
| "tsType": "import('../../lib/ManifestPlugin').Generate" | ||
| }, | ||
@@ -97,5 +97,5 @@ "prefix": { | ||
| "instanceof": "Function", | ||
| "tsType": "(manifest: ManifestObject) => string" | ||
| "tsType": "import('../../lib/ManifestPlugin').Serialize" | ||
| } | ||
| } | ||
| } |
@@ -6,3 +6,3 @@ { | ||
| "instanceof": "Function", | ||
| "tsType": "(import(\"../../lib/ProgressPlugin\").HandlerFn)" | ||
| "tsType": "import('../../lib/ProgressPlugin').HandlerFn" | ||
| }, | ||
@@ -9,0 +9,0 @@ "ProgressPluginOptions": { |
@@ -62,3 +62,3 @@ { | ||
| "instanceof": "Function", | ||
| "tsType": "((uri: string) => boolean)" | ||
| "tsType": "import('../../../lib/schemes/HttpUriPlugin').AllowedUriFn" | ||
| } | ||
@@ -65,0 +65,0 @@ ] |
@@ -11,3 +11,3 @@ { | ||
| "instanceof": "Function", | ||
| "tsType": "(import('../../../lib/schemes/VirtualUrlPlugin').SourceFn)" | ||
| "tsType": "import('../../../lib/schemes/VirtualUrlPlugin').SourceFn" | ||
| }, | ||
@@ -30,3 +30,3 @@ "type": { | ||
| "instanceof": "Function", | ||
| "tsType": "(import('../../../lib/schemes/VirtualUrlPlugin').VersionFn)" | ||
| "tsType": "import('../../../lib/schemes/VirtualUrlPlugin').VersionFn" | ||
| } | ||
@@ -46,3 +46,3 @@ ] | ||
| "instanceof": "Function", | ||
| "tsType": "(import('../../../lib/schemes/VirtualUrlPlugin').SourceFn)" | ||
| "tsType": "import('../../../lib/schemes/VirtualUrlPlugin').SourceFn" | ||
| }, | ||
@@ -49,0 +49,0 @@ { |
@@ -16,3 +16,3 @@ { | ||
| "instanceof": "Function", | ||
| "tsType": "((str: string) => boolean)" | ||
| "tsType": "import('../../lib/ModuleFilenameHelpers').MatcherFn" | ||
| } | ||
@@ -58,3 +58,3 @@ ] | ||
| "instanceof": "Function", | ||
| "tsType": "(import(\"../../lib/TemplatedPathPlugin\").TemplatePathFn)" | ||
| "tsType": "import('../../lib/TemplatedPathPlugin').TemplatePathFn" | ||
| } | ||
@@ -61,0 +61,0 @@ ] |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 3 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 3 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
5782874
0.12%165715
0.12%86
8.86%