| /* | ||
| * This file was automatically generated. | ||
| * DO NOT MODIFY BY HAND. | ||
| * Run `yarn fix:special` to update | ||
| */ | ||
| declare const check: (options: import("../../../declarations/plugins/ids/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions) => boolean; | ||
| export = check; |
| /* | ||
| * This file was automatically generated. | ||
| * DO NOT MODIFY BY HAND. | ||
| * Run `yarn fix:special` to update | ||
| */ | ||
| const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function e(s,{instancePath:r="",parentData:n,parentDataProperty:a,rootData:i=s}={}){let o=null,l=0;if(0===l){if(!s||"object"!=typeof s||Array.isArray(s))return e.errors=[{params:{type:"object"}}],!1;{const r=l;for(const t in s)if("context"!==t&&"hashDigest"!==t&&"hashDigestLength"!==t&&"hashFunction"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(r===l){if(void 0!==s.context){let r=s.context;const n=l;if(l===n){if("string"!=typeof r)return e.errors=[{params:{type:"string"}}],!1;if(r.includes("!")||!0!==t.test(r))return e.errors=[{params:{}}],!1}var u=n===l}else u=!0;if(u){if(void 0!==s.hashDigest){let t=s.hashDigest;const r=l;if("base64"!==t&&"base64url"!==t&&"hex"!==t&&"binary"!==t&&"utf8"!==t&&"utf-8"!==t&&"utf16le"!==t&&"utf-16le"!==t&&"latin1"!==t&&"ascii"!==t&&"ucs2"!==t&&"ucs-2"!==t)return e.errors=[{params:{}}],!1;u=r===l}else u=!0;if(u){if(void 0!==s.hashDigestLength){let t=s.hashDigestLength;const r=l;if(l===r){if("number"!=typeof t)return e.errors=[{params:{type:"number"}}],!1;if(t<1||isNaN(t))return e.errors=[{params:{comparison:">=",limit:1}}],!1}u=r===l}else u=!0;if(u)if(void 0!==s.hashFunction){let t=s.hashFunction;const r=l,n=l;let a=!1,i=null;const c=l,p=l;let h=!1;const m=l;if(l===m)if("string"==typeof t){if(t.length<1){const t={params:{}};null===o?o=[t]:o.push(t),l++}}else{const t={params:{type:"string"}};null===o?o=[t]:o.push(t),l++}var f=m===l;if(h=h||f,!h){const e=l;if(!(t instanceof Function)){const t={params:{}};null===o?o=[t]:o.push(t),l++}f=e===l,h=h||f}if(h)l=p,null!==o&&(p?o.length=p:o=null);else{const t={params:{}};null===o?o=[t]:o.push(t),l++}if(c===l&&(a=!0,i=0),!a){const t={params:{passingSchemas:i}};return null===o?o=[t]:o.push(t),l++,e.errors=o,!1}l=n,null!==o&&(n?o.length=n:o=null),u=r===l}else u=!0}}}}}return e.errors=o,0===l}module.exports=e,module.exports.default=e; |
| { | ||
| "definitions": { | ||
| "HashFunction": { | ||
| "description": "Algorithm used for generation the hash (see node.js crypto package).", | ||
| "anyOf": [ | ||
| { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| { | ||
| "instanceof": "Function", | ||
| "tsType": "typeof import('../../../lib/util/Hash')" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "title": "HashedModuleIdsPluginOptions", | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "context": { | ||
| "description": "The context directory for creating names.", | ||
| "type": "string", | ||
| "absolutePath": true | ||
| }, | ||
| "hashDigest": { | ||
| "description": "The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.", | ||
| "enum": [ | ||
| "base64", | ||
| "base64url", | ||
| "hex", | ||
| "binary", | ||
| "utf8", | ||
| "utf-8", | ||
| "utf16le", | ||
| "utf-16le", | ||
| "latin1", | ||
| "ascii", | ||
| "ucs2", | ||
| "ucs-2" | ||
| ] | ||
| }, | ||
| "hashDigestLength": { | ||
| "description": "The prefix length of the hash digest to use, defaults to 4.", | ||
| "type": "number", | ||
| "minimum": 1 | ||
| }, | ||
| "hashFunction": { | ||
| "description": "The hashing algorithm to use, defaults to 'md4'. All functions from Node.JS' crypto.createHash are supported.", | ||
| "oneOf": [ | ||
| { | ||
| "$ref": "#/definitions/HashFunction" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
@@ -56,2 +56,3 @@ /* | ||
| runtimeRequirements.add(RuntimeGlobals.requireScope); | ||
| runtimeRequirements.add(RuntimeGlobals.toBinary); | ||
@@ -58,0 +59,0 @@ |
@@ -247,7 +247,6 @@ /* | ||
| const fullContentHash = /** @type {string} */ ( | ||
| hash.digest(runtimeTemplate.outputOptions.hashDigest) | ||
| const fullContentHash = hash.digest( | ||
| runtimeTemplate.outputOptions.hashDigest | ||
| ); | ||
| /** @type {string} */ | ||
| const contentHash = nonNumericOnlyHash( | ||
@@ -254,0 +253,0 @@ fullContentHash, |
@@ -37,3 +37,3 @@ /* | ||
| this._obj.updateHash(hash); | ||
| this._hash = /** @type {string} */ (hash.digest("base64")); | ||
| this._hash = hash.digest("base64"); | ||
| } | ||
@@ -40,0 +40,0 @@ return this._hash; |
@@ -1673,3 +1673,3 @@ /* | ||
| this.moduleGraph.getExportsInfo(module).updateHash(hash, runtime); | ||
| return BigInt(`0x${/** @type {string} */ (hash.digest("hex"))}`); | ||
| return BigInt(`0x${hash.digest("hex")}`); | ||
| }); | ||
@@ -1812,3 +1812,3 @@ return graphHash; | ||
| hash.update(graphHash); | ||
| return /** @type {string} */ (hash.digest("hex")); | ||
| return hash.digest("hex"); | ||
| }); | ||
@@ -1815,0 +1815,0 @@ } |
@@ -144,3 +144,3 @@ /* | ||
| } | ||
| return (info.hash = /** @type {string} */ (hash.digest("hex"))); | ||
| return (info.hash = hash.digest("hex")); | ||
| } | ||
@@ -147,0 +147,0 @@ |
@@ -19,54 +19,41 @@ /* | ||
| /** | ||
| * @typedef {object} BrowserslistHandlerConfig | ||
| * @property {string=} configPath | ||
| * @property {string=} env | ||
| * @property {string=} query | ||
| */ | ||
| /** | ||
| * @param {string | null | undefined} input input string | ||
| * @param {string} context the context directory | ||
| * @returns {BrowserslistHandlerConfig} config | ||
| * @returns {string[] | undefined} selected browsers | ||
| */ | ||
| const parse = (input, context) => { | ||
| if (!input) { | ||
| return {}; | ||
| } | ||
| if (path.isAbsolute(input)) { | ||
| const load = (input, context) => { | ||
| // browserslist:path-to-config | ||
| // browserslist:path-to-config:env | ||
| if (input && path.isAbsolute(input)) { | ||
| const [, configPath, env] = inputRx.exec(input) || []; | ||
| return { configPath, env }; | ||
| } | ||
| const config = browserslist.findConfig(context); | ||
| const config = browserslist.loadConfig({ | ||
| config: configPath, | ||
| env | ||
| }); | ||
| if (config && Object.keys(config).includes(input)) { | ||
| return { env: input }; | ||
| return browserslist(config, { env }); | ||
| } | ||
| return { query: input }; | ||
| }; | ||
| const env = input || undefined; | ||
| /** | ||
| * @param {string | null | undefined} input input string | ||
| * @param {string} context the context directory | ||
| * @returns {string[] | undefined} selected browsers | ||
| */ | ||
| const load = (input, context) => { | ||
| const { configPath, env, query } = parse(input, context); | ||
| const config = browserslist.loadConfig({ | ||
| path: context, | ||
| env | ||
| }); | ||
| // if a query is specified, then use it, else | ||
| // if a path to a config is specified then load it, else | ||
| // find a nearest config | ||
| const config = | ||
| query || | ||
| (configPath | ||
| ? browserslist.loadConfig({ | ||
| config: configPath, | ||
| env | ||
| }) | ||
| : browserslist.loadConfig({ path: context, env })); | ||
| // browserslist | ||
| // browserslist:env | ||
| if (config) { | ||
| try { | ||
| return browserslist(config, { env, throwOnMissing: true }); | ||
| } catch (_err) { | ||
| // Nothing, no `env` was found in browserslist, maybe input is `queries` | ||
| } | ||
| } | ||
| if (!config) return; | ||
| return browserslist(config); | ||
| // browserslist:query | ||
| if (env) { | ||
| return browserslist(env); | ||
| } | ||
| }; | ||
@@ -108,24 +95,2 @@ | ||
| const nodeProperty = !anyNode ? false : anyBrowser ? null : true; | ||
| // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features | ||
| const es6DynamicImport = rawChecker({ | ||
| /* eslint-disable camelcase */ | ||
| chrome: 63, | ||
| and_chr: 63, | ||
| edge: 79, | ||
| firefox: 67, | ||
| and_ff: 67, | ||
| // ie: Not supported | ||
| opera: 50, | ||
| op_mob: 46, | ||
| safari: [11, 1], | ||
| ios_saf: [11, 3], | ||
| samsung: [8, 2], | ||
| android: 63, | ||
| and_qq: [10, 4], | ||
| baidu: [13, 18], | ||
| and_uc: [15, 5], | ||
| kaios: [3, 0], | ||
| node: [12, 17] | ||
| /* eslint-enable camelcase */ | ||
| }); | ||
@@ -193,5 +158,5 @@ return { | ||
| android: 38, | ||
| // and_qq: Unknown support | ||
| and_qq: [10, 4], | ||
| // baidu: Unknown support | ||
| // and_uc: Unknown support | ||
| and_uc: [12, 12], | ||
| kaios: [3, 0], | ||
@@ -213,5 +178,5 @@ node: [0, 12] | ||
| android: 49, | ||
| // and_qq: Unknown support | ||
| and_qq: [10, 4], | ||
| // baidu: Unknown support | ||
| // and_uc: Unknown support | ||
| and_uc: [12, 12], | ||
| kaios: [2, 5], | ||
@@ -260,4 +225,40 @@ node: [6, 0] | ||
| }), | ||
| dynamicImport: es6DynamicImport, | ||
| dynamicImportInWorker: es6DynamicImport && !anyNode, | ||
| dynamicImport: rawChecker({ | ||
| chrome: 63, | ||
| and_chr: 63, | ||
| edge: 79, | ||
| firefox: 67, | ||
| and_ff: 67, | ||
| // ie: Not supported | ||
| opera: 50, | ||
| op_mob: 46, | ||
| safari: [11, 1], | ||
| ios_saf: [11, 3], | ||
| samsung: [8, 2], | ||
| android: 63, | ||
| and_qq: [10, 4], | ||
| baidu: [13, 18], | ||
| and_uc: [15, 5], | ||
| kaios: [3, 0], | ||
| node: [12, 17] | ||
| }), | ||
| dynamicImportInWorker: rawChecker({ | ||
| chrome: 80, | ||
| and_chr: 80, | ||
| edge: 80, | ||
| firefox: 114, | ||
| and_ff: 114, | ||
| // ie: Not supported | ||
| opera: 67, | ||
| op_mob: 57, | ||
| safari: [15, 0], | ||
| ios_saf: [15, 0], | ||
| samsung: [13, 0], | ||
| android: 80, | ||
| and_qq: [10, 4], | ||
| baidu: [13, 18], | ||
| and_uc: [15, 5], | ||
| kaios: [3, 0], | ||
| node: [12, 17] | ||
| }), | ||
| // browserslist does not have info about globalThis | ||
@@ -278,5 +279,5 @@ // so this is based on mdn-browser-compat-data | ||
| android: 71, | ||
| // and_qq: Unknown support | ||
| and_qq: [13, 1], | ||
| // baidu: Unknown support | ||
| // and_uc: Unknown support | ||
| and_uc: [15, 5], | ||
| kaios: [3, 0], | ||
@@ -298,5 +299,5 @@ node: 12 | ||
| android: 80, | ||
| // and_qq: Not supported | ||
| and_qq: [13, 1], | ||
| // baidu: Not supported | ||
| // and_uc: Not supported | ||
| and_uc: [15, 5], | ||
| kaios: [3, 0], | ||
@@ -337,5 +338,5 @@ node: 14 | ||
| android: 55, | ||
| and_qq: [13, 1], | ||
| and_qq: [10, 4], | ||
| baidu: [13, 18], | ||
| and_uc: [15, 5], | ||
| and_uc: [12, 12], | ||
| kaios: 3, | ||
@@ -356,3 +357,3 @@ node: [7, 6] | ||
| importScripts: false, | ||
| importScriptsInWorker: true, | ||
| importScriptsInWorker: Boolean(browserProperty), | ||
| nodeBuiltins: nodeProperty, | ||
@@ -359,0 +360,0 @@ nodePrefixForCoreModules: |
@@ -1329,4 +1329,9 @@ /* | ||
| "For the selected environment is no default script chunk format available:\n" + | ||
| "JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" + | ||
| `CommonJs exports can be chosen when 'require' or node builtins are available.\n${ | ||
| `${ | ||
| tp.module | ||
| ? "Module ('module') can be chosen when ES modules are available (please set 'experiments.outputModule' and 'output.module' to `true`)" | ||
| : "" | ||
| }\n` + | ||
| "JSONP Array push ('array-push') can be chosen when 'document' or 'importScripts' is available.\n" + | ||
| `CommonJs exports ('commonjs') can be chosen when 'require' or node builtins are available.\n${ | ||
| helpMessage | ||
@@ -1333,0 +1338,0 @@ }` |
@@ -19,3 +19,3 @@ /* | ||
| const getDefaultTarget = (context) => { | ||
| const browsers = getBrowserslistTargetHandler().load(null, context); | ||
| const browsers = getBrowserslistTargetHandler().load(undefined, context); | ||
| return browsers ? "browserslist" : "web"; | ||
@@ -22,0 +22,0 @@ }; |
@@ -257,6 +257,8 @@ /* | ||
| } | ||
| if (this.options.attributes) { | ||
| identifier += `|importAttributes: ${JSON.stringify(this.options.attributes)}`; | ||
| } | ||
| if (this.layer) { | ||
| identifier += `|layer: ${this.layer}`; | ||
| } | ||
| return identifier; | ||
@@ -263,0 +265,0 @@ } |
@@ -473,8 +473,4 @@ /* | ||
| } | ||
| const digest = /** @type {string} */ (hash.digest(hashDigest)); | ||
| chunk.contentHash.css = nonNumericOnlyHash( | ||
| digest, | ||
| /** @type {number} */ | ||
| (hashDigestLength) | ||
| ); | ||
| const digest = hash.digest(hashDigest); | ||
| chunk.contentHash.css = nonNumericOnlyHash(digest, hashDigestLength); | ||
| }); | ||
@@ -481,0 +477,0 @@ compilation.hooks.renderManifest.tap(PLUGIN_NAME, (result, options) => { |
@@ -69,3 +69,3 @@ /* | ||
| const CC_UPPER_E = "E".charCodeAt(0); | ||
| const CC_UPPER_U = "E".charCodeAt(0); | ||
| const CC_UPPER_U = "U".charCodeAt(0); | ||
| const CC_UPPER_Z = "Z".charCodeAt(0); | ||
@@ -72,0 +72,0 @@ const CC_0 = "0".charCodeAt(0); |
@@ -833,3 +833,3 @@ /* | ||
| VALUE_DEP_MAIN, | ||
| /** @type {string} */ (mainHash.digest("hex").slice(0, 8)) | ||
| mainHash.digest("hex").slice(0, 8) | ||
| ); | ||
@@ -836,0 +836,0 @@ } |
@@ -71,4 +71,4 @@ /* | ||
| let str = super.getResourceIdentifier(); | ||
| if (this.attributes !== undefined) { | ||
| str += JSON.stringify(this.attributes); | ||
| if (this.attributes) { | ||
| str += `|importAttributes${JSON.stringify(this.attributes)}`; | ||
| } | ||
@@ -75,0 +75,0 @@ return str; |
@@ -67,5 +67,3 @@ /* | ||
| const localIdentHash = | ||
| /** @type {string} */ | ||
| (hash.digest(hashDigest)).slice(0, hashDigestLength); | ||
| const localIdentHash = hash.digest(hashDigest).slice(0, hashDigestLength); | ||
@@ -72,0 +70,0 @@ return runtimeTemplate.compilation |
@@ -82,5 +82,8 @@ /* | ||
| let str = super.getResourceIdentifier(); | ||
| if (this.attributes !== undefined) { | ||
| str += JSON.stringify(this.attributes); | ||
| if (this.defer) { | ||
| str += "|defer"; | ||
| } | ||
| if (this.attributes) { | ||
| str += `|importAttributes${JSON.stringify(this.attributes)}`; | ||
| } | ||
| return str; | ||
@@ -87,0 +90,0 @@ } |
@@ -39,2 +39,15 @@ /* | ||
| /** | ||
| * @returns {string | null} an identifier to merge equal requests | ||
| */ | ||
| getResourceIdentifier() { | ||
| let str = super.getResourceIdentifier(); | ||
| if (this.options.attributes) { | ||
| str += `|importAttributes${JSON.stringify(this.options.attributes)}`; | ||
| } | ||
| return str; | ||
| } | ||
| /** | ||
| * @param {ObjectSerializerContext} context context | ||
@@ -41,0 +54,0 @@ */ |
@@ -53,4 +53,4 @@ /* | ||
| let str = super.getResourceIdentifier(); | ||
| if (this.attributes !== undefined) { | ||
| str += JSON.stringify(this.attributes); | ||
| if (this.attributes) { | ||
| str += `|importAttributes${JSON.stringify(this.attributes)}`; | ||
| } | ||
@@ -57,0 +57,0 @@ return str; |
@@ -118,3 +118,3 @@ /* | ||
| new CriticalDependencyWarning( | ||
| "Accessing import.meta directly is unsupported (only property access or destructuring is supported)" | ||
| "'import.meta' cannot be used as a standalone expression. For static analysis, its properties must be accessed directly (e.g., 'import.meta.url') or through destructuring." | ||
| ), | ||
@@ -121,0 +121,0 @@ /** @type {DependencyLocation} */ (metaProperty.loc) |
@@ -381,5 +381,3 @@ /* | ||
| hash.update(name); | ||
| const digest = | ||
| /** @type {string} */ | ||
| (hash.digest(compilation.outputOptions.hashDigest)); | ||
| const digest = hash.digest(compilation.outputOptions.hashDigest); | ||
| entryOptions.runtime = digest.slice( | ||
@@ -386,0 +384,0 @@ 0, |
@@ -51,3 +51,3 @@ /* | ||
| hash.update(`${this._hash}${part}`); | ||
| this._hash = /** @type {string} */ (hash.digest("hex")); | ||
| this._hash = hash.digest("hex"); | ||
| } | ||
@@ -54,0 +54,0 @@ |
@@ -19,8 +19,8 @@ /* | ||
| /** @typedef {import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */ | ||
| /** @typedef {import("../../declarations/plugins/ids/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */ | ||
| /** @typedef {import("../Compiler")} Compiler */ | ||
| const validate = createSchemaValidation( | ||
| require("../../schemas/plugins/HashedModuleIdsPlugin.check"), | ||
| () => require("../../schemas/plugins/HashedModuleIdsPlugin.json"), | ||
| require("../../schemas/plugins/ids/HashedModuleIdsPlugin.check"), | ||
| () => require("../../schemas/plugins/ids/HashedModuleIdsPlugin.json"), | ||
| { | ||
@@ -41,3 +41,3 @@ name: "Hashed Module Ids Plugin", | ||
| /** @type {HashedModuleIdsPluginOptions} */ | ||
| /** @type {Required<Omit<HashedModuleIdsPluginOptions, "context">> & { context?: string | undefined }} */ | ||
| this.options = { | ||
@@ -78,5 +78,3 @@ context: undefined, | ||
| hash.update(ident || ""); | ||
| const hashId = /** @type {string} */ ( | ||
| hash.digest(options.hashDigest) | ||
| ); | ||
| const hashId = hash.digest(options.hashDigest); | ||
| let len = options.hashDigestLength; | ||
@@ -83,0 +81,0 @@ while (usedIds.has(hashId.slice(0, len))) { |
@@ -28,3 +28,3 @@ /* | ||
| hash.update(str); | ||
| const digest = /** @type {string} */ (hash.digest("hex")); | ||
| const digest = hash.digest("hex"); | ||
| return digest.slice(0, len); | ||
@@ -31,0 +31,0 @@ }; |
@@ -506,7 +506,6 @@ /* | ||
| } | ||
| const digest = /** @type {string} */ (hash.digest(hashDigest)); | ||
| const digest = hash.digest(hashDigest); | ||
| chunk.contentHash.javascript = nonNumericOnlyHash( | ||
| digest, | ||
| /** @type {number} */ | ||
| (hashDigestLength) | ||
| hashDigestLength | ||
| ); | ||
@@ -513,0 +512,0 @@ }); |
@@ -137,7 +137,17 @@ /* | ||
| if (otherUnused || used !== exportInfo.name) { | ||
| instructions.push( | ||
| `${external}${propertyAccess([ | ||
| used | ||
| ])} = module${propertyAccess([exportInfo.name])};` | ||
| ); | ||
| if (exportInfo.name === "default") { | ||
| // Ideally we should use `module && module.__esModule ? module['default'] : module` | ||
| // But we need to keep compatibility with SystemJS format libraries (they are using `default`) and bundled SystemJS libraries from commonjs format | ||
| instructions.push( | ||
| `${external}${propertyAccess([ | ||
| used | ||
| ])} = module["default"] || module;` | ||
| ); | ||
| } else { | ||
| instructions.push( | ||
| `${external}${propertyAccess([ | ||
| used | ||
| ])} = module${propertyAccess([exportInfo.name])};` | ||
| ); | ||
| } | ||
| handledNames.push(exportInfo.name); | ||
@@ -144,0 +154,0 @@ } |
@@ -87,3 +87,3 @@ /* | ||
| hash.update(strFn()); | ||
| const digest = /** @type {string} */ (hash.digest("hex")); | ||
| const digest = hash.digest("hex"); | ||
| return digest.slice(0, 4); | ||
@@ -90,0 +90,0 @@ }; |
@@ -1214,3 +1214,3 @@ /* | ||
| /** @type {BuildInfo} */ | ||
| (this.buildInfo).hash = /** @type {string} */ (hash.digest("hex")); | ||
| (this.buildInfo).hash = hash.digest("hex"); | ||
| } | ||
@@ -1217,0 +1217,0 @@ |
@@ -117,2 +117,3 @@ /* | ||
| /** @typedef {import("./ModuleTypeConstants").ASSET_MODULE_TYPE_SOURCE} ASSET_MODULE_TYPE_SOURCE */ | ||
| /** @typedef {import("./ModuleTypeConstants").ASSET_MODULE_TYPE_BYTES} ASSET_MODULE_TYPE_BYTES */ | ||
| /** @typedef {import("./ModuleTypeConstants").WEBASSEMBLY_MODULE_TYPE_ASYNC} WEBASSEMBLY_MODULE_TYPE_ASYNC */ | ||
@@ -272,2 +273,72 @@ /** @typedef {import("./ModuleTypeConstants").WEBASSEMBLY_MODULE_TYPE_SYNC} WEBASSEMBLY_MODULE_TYPE_SYNC */ | ||
| /** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */ | ||
| /** @typedef {import("../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ | ||
| /** @typedef {import("./javascript/JavascriptGenerator")} JavascriptGenerator */ | ||
| /** @typedef {import("../declarations/WebpackOptions").EmptyGeneratorOptions} EmptyGeneratorOptions */ | ||
| /** @typedef {import("./json/JsonParser")} JsonParser */ | ||
| /** @typedef {import("../declarations/WebpackOptions").JsonParserOptions} JsonParserOptions */ | ||
| /** @typedef {import("./json/JsonGenerator")} JsonGenerator */ | ||
| /** @typedef {import("../declarations/WebpackOptions").JsonGeneratorOptions} JsonGeneratorOptions */ | ||
| /** @typedef {import("./asset/AssetParser")} AssetParser */ | ||
| /** @typedef {import("./asset/AssetSourceParser")} AssetSourceParser */ | ||
| /** @typedef {import("./asset/AssetBytesParser")} AssetBytesParser */ | ||
| /** @typedef {import("../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").EmptyParserOptions} EmptyParserOptions */ | ||
| /** @typedef {import("./asset/AssetGenerator")} AssetGenerator */ | ||
| /** @typedef {import("../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").AssetInlineGeneratorOptions} AssetInlineGeneratorOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").AssetResourceGeneratorOptions} AssetResourceGeneratorOptions */ | ||
| /** @typedef {import("./asset/AssetSourceGenerator")} AssetSourceGenerator */ | ||
| /** @typedef {import("./asset/AssetBytesGenerator")} AssetBytesGenerator */ | ||
| /** @typedef {import("./wasm-async/AsyncWebAssemblyParser")} AsyncWebAssemblyParser */ | ||
| /** @typedef {import("./wasm-sync/WebAssemblyParser")} WebAssemblyParser */ | ||
| /** @typedef {import("./css/CssParser")} CssParser */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssParserOptions} CssParserOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssAutoParserOptions} CssAutoParserOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssGlobalParserOptions} CssGlobalParserOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssModuleParserOptions} CssModuleParserOptions */ | ||
| /** @typedef {import("./css/CssGenerator")} CssGenerator */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssGeneratorOptions} CssGeneratorOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssGlobalGeneratorOptions} CssGlobalGeneratorOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssModuleGeneratorOptions} CssModuleGeneratorOptions */ | ||
| /** @typedef {import("../declarations/WebpackOptions").CssAutoGeneratorOptions} CssAutoGeneratorOptions */ | ||
| /** | ||
| * @typedef {[ | ||
| * [JAVASCRIPT_MODULE_TYPE_AUTO, JavascriptParser, JavascriptParserOptions, JavascriptGenerator, EmptyGeneratorOptions], | ||
| * [JAVASCRIPT_MODULE_TYPE_DYNAMIC, JavascriptParser, JavascriptParserOptions, JavascriptGenerator, EmptyGeneratorOptions], | ||
| * [JAVASCRIPT_MODULE_TYPE_ESM, JavascriptParser, JavascriptParserOptions, JavascriptGenerator, EmptyGeneratorOptions], | ||
| * [JSON_MODULE_TYPE, JsonParser, JsonParserOptions, JsonGenerator, JsonGeneratorOptions], | ||
| * [ASSET_MODULE_TYPE, AssetParser, AssetParserOptions, AssetGenerator, AssetGeneratorOptions], | ||
| * [ASSET_MODULE_TYPE_INLINE, AssetParser, EmptyParserOptions, AssetGenerator, AssetGeneratorOptions], | ||
| * [ASSET_MODULE_TYPE_RESOURCE, AssetParser, EmptyParserOptions, AssetGenerator, AssetGeneratorOptions], | ||
| * [ASSET_MODULE_TYPE_SOURCE, AssetSourceParser, EmptyParserOptions, AssetSourceGenerator, EmptyGeneratorOptions], | ||
| * [ASSET_MODULE_TYPE_BYTES, AssetBytesParser, EmptyParserOptions, AssetBytesGenerator, EmptyGeneratorOptions], | ||
| * [WEBASSEMBLY_MODULE_TYPE_ASYNC, AsyncWebAssemblyParser, EmptyParserOptions, Generator, EmptyParserOptions], | ||
| * [WEBASSEMBLY_MODULE_TYPE_SYNC, WebAssemblyParser, EmptyParserOptions, Generator, EmptyParserOptions], | ||
| * [CSS_MODULE_TYPE, CssParser, CssParserOptions, CssGenerator, CssGeneratorOptions], | ||
| * [CSS_MODULE_TYPE_AUTO, CssParser, CssAutoParserOptions, CssGenerator, CssAutoGeneratorOptions], | ||
| * [CSS_MODULE_TYPE_MODULE, CssParser, CssModuleParserOptions, CssGenerator, CssModuleGeneratorOptions], | ||
| * [CSS_MODULE_TYPE_GLOBAL, CssParser, CssGlobalParserOptions, CssGenerator, CssGlobalGeneratorOptions], | ||
| * [string, Parser, ParserOptions, Generator, GeneratorOptions], | ||
| * ]} ParsersAndGeneratorsByTypes | ||
| */ | ||
| /** | ||
| * @template {unknown[]} T | ||
| * @template {number[]} I | ||
| * @typedef {{ [K in keyof I]: K extends keyof I ? I[K] extends keyof T ? T[I[K]] : never : never }} ExtractTupleElements | ||
| */ | ||
| /** | ||
| * @template {unknown[]} T | ||
| * @template {number[]} A | ||
| * @template [R=void] | ||
| * @typedef {T extends [infer Head extends [string, ...unknown[]], ...infer Tail extends [string, ...unknown[]][]] ? Record<Head[0], SyncBailHook<ExtractTupleElements<Head, A>, R extends number ? Head[R] : R>> & RecordFactoryFromTuple<Tail, A, R> : unknown } RecordFactoryFromTuple | ||
| */ | ||
| class NormalModuleFactory extends ModuleFactory { | ||
@@ -311,11 +382,11 @@ /** | ||
| module: new SyncWaterfallHook(["module", "createData", "resolveData"]), | ||
| /** @type {HookMap<SyncBailHook<[ParserOptions], Parser | void>>} */ | ||
| /** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [2], 1>>} */ | ||
| createParser: new HookMap(() => new SyncBailHook(["parserOptions"])), | ||
| /** @type {HookMap<SyncBailHook<[EXPECTED_ANY, ParserOptions], void>>} */ | ||
| /** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [1, 2]>>} */ | ||
| parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])), | ||
| /** @type {HookMap<SyncBailHook<[GeneratorOptions], Generator | void>>} */ | ||
| /** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [4], 3>>} */ | ||
| createGenerator: new HookMap( | ||
| () => new SyncBailHook(["generatorOptions"]) | ||
| ), | ||
| /** @type {HookMap<SyncBailHook<[EXPECTED_ANY, GeneratorOptions], void>>} */ | ||
| /** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [3, 4]>>} */ | ||
| generator: new HookMap( | ||
@@ -322,0 +393,0 @@ () => new SyncHook(["generator", "generatorOptions"]) |
@@ -15,2 +15,4 @@ /* | ||
| /** @typedef {import("../../declarations/WebpackOptions").HashFunction} HashFunction */ | ||
| /** @typedef {import("../../declarations/WebpackOptions").HashDigest} HashDigest */ | ||
| /** @typedef {import("webpack-sources").Source} Source */ | ||
@@ -113,4 +115,4 @@ /** @typedef {import("../Cache").Etag} Etag */ | ||
| * @typedef {object} RealContentHashPluginOptions | ||
| * @property {string | Hash} hashFunction the hash function to use | ||
| * @property {string=} hashDigest the hash digest to use | ||
| * @property {HashFunction} hashFunction the hash function to use | ||
| * @property {HashDigest} hashDigest the hash digest to use | ||
| */ | ||
@@ -437,3 +439,3 @@ | ||
| const digest = hash.digest(this._hashDigest); | ||
| newHash = /** @type {string} */ (digest.slice(0, oldHash.length)); | ||
| newHash = digest.slice(0, oldHash.length); | ||
| } | ||
@@ -440,0 +442,0 @@ hashToNewHash.set(oldHash, newHash); |
@@ -952,3 +952,12 @@ /* | ||
| if (isDeferred && exportsType !== "namespace") { | ||
| const access = `${importVar}.a${propertyAccess(exportName, 1)}`; | ||
| const exportsInfo = moduleGraph.getExportsInfo(module); | ||
| const name = exportName.slice(1); | ||
| const used = exportsInfo.getUsedName(name, runtime); | ||
| if (!used) { | ||
| const comment = Template.toNormalComment( | ||
| `unused export ${propertyAccess(exportName)}` | ||
| ); | ||
| return `${comment} undefined`; | ||
| } | ||
| const access = `${importVar}.a${propertyAccess(used)}`; | ||
| if (isCall || asiSafe === undefined) { | ||
@@ -955,0 +964,0 @@ return access; |
@@ -58,3 +58,3 @@ /* | ||
| for (const buf of buffers) hash.update(buf); | ||
| return /** @type {string} */ (hash.digest("hex")); | ||
| return hash.digest("hex"); | ||
| }; | ||
@@ -61,0 +61,0 @@ |
@@ -120,3 +120,3 @@ /* | ||
| hash.update(buffer); | ||
| return /** @type {string} */ (hash.digest("latin1")); | ||
| return hash.digest("latin1"); | ||
| }; | ||
@@ -123,0 +123,0 @@ |
@@ -485,10 +485,8 @@ /* | ||
| const filename = file; | ||
| const sourceMapContentHash = | ||
| /** @type {string} */ | ||
| ( | ||
| usesContentHash && | ||
| createHash(compilation.outputOptions.hashFunction) | ||
| .update(sourceMapString) | ||
| .digest("hex") | ||
| ); | ||
| const sourceMapContentHash = usesContentHash | ||
| ? createHash(compilation.outputOptions.hashFunction) | ||
| .update(sourceMapString) | ||
| .digest("hex") | ||
| : undefined; | ||
| const pathParams = { | ||
@@ -495,0 +493,0 @@ chunk, |
@@ -11,3 +11,3 @@ /* | ||
| /** @typedef {import("schema-utils").Schema} Schema */ | ||
| /** @typedef {import("schema-utils/declarations/validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ | ||
| /** @typedef {import("schema-utils").ValidationErrorConfiguration} ValidationErrorConfiguration */ | ||
@@ -14,0 +14,0 @@ const getValidate = memoize(() => require("schema-utils").validate); |
+85
-15
@@ -10,5 +10,6 @@ /* | ||
| /** @typedef {import("../../declarations/WebpackOptions").HashDigest} Encoding */ | ||
| /** @typedef {import("../../declarations/WebpackOptions").HashFunction} HashFunction */ | ||
| const BULK_SIZE = 2000; | ||
| const BULK_SIZE = 3; | ||
@@ -42,6 +43,19 @@ // We are using an object instead of a Map as this will stay static during the runtime | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @param {string|Buffer} data data | ||
| * @param {string=} inputEncoding data encoding | ||
| * @returns {this} updated hash | ||
| * @overload | ||
| * @param {string | Buffer} data data | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @overload | ||
| * @param {string} data data | ||
| * @param {Encoding} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @param {string | Buffer} data data | ||
| * @param {Encoding=} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| update(data, inputEncoding) { | ||
@@ -60,3 +74,7 @@ if ( | ||
| } | ||
| this.hash.update(data, inputEncoding); | ||
| if (typeof data === "string" && inputEncoding) { | ||
| this.hash.update(data, inputEncoding); | ||
| } else { | ||
| this.hash.update(data); | ||
| } | ||
| } else { | ||
@@ -77,5 +95,16 @@ this.buffer += data; | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @param {string=} encoding encoding of the return value | ||
| * @returns {string|Buffer} digest | ||
| * @overload | ||
| * @returns {Buffer} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @overload | ||
| * @param {Encoding} encoding encoding of the return value | ||
| * @returns {string} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @param {Encoding=} encoding encoding of the return value | ||
| * @returns {string | Buffer} digest | ||
| */ | ||
| digest(encoding) { | ||
@@ -98,5 +127,15 @@ let digestCache; | ||
| } | ||
| if (!encoding) { | ||
| const result = this.hash.digest(); | ||
| if (digestCache !== undefined) { | ||
| digestCache.set(buffer, result); | ||
| } | ||
| return result; | ||
| } | ||
| const digestResult = this.hash.digest(encoding); | ||
| // Compatibility with the old hash library | ||
| const result = | ||
| typeof digestResult === "string" ? digestResult : digestResult.toString(); | ||
| typeof digestResult === "string" | ||
| ? digestResult | ||
| : /** @type {NodeJS.TypedArray} */ (digestResult).toString(); | ||
| if (digestCache !== undefined) { | ||
@@ -118,6 +157,19 @@ digestCache.set(buffer, result); | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @param {string|Buffer} data data | ||
| * @param {string=} inputEncoding data encoding | ||
| * @returns {this} updated hash | ||
| * @overload | ||
| * @param {string | Buffer} data data | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @overload | ||
| * @param {string} data data | ||
| * @param {Encoding} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @param {string | Buffer} data data | ||
| * @param {Encoding=} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| update(data, inputEncoding) { | ||
@@ -141,5 +193,16 @@ if (typeof data !== "string") data = data.toString("utf8"); | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @param {string=} encoding encoding of the return value | ||
| * @returns {string|Buffer} digest | ||
| * @overload | ||
| * @returns {Buffer} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @overload | ||
| * @param {Encoding} encoding encoding of the return value | ||
| * @returns {string} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @param {Encoding=} encoding encoding of the return value | ||
| * @returns {string | Buffer} digest | ||
| */ | ||
| digest(encoding) { | ||
@@ -196,3 +259,7 @@ return Buffer.from(`@webpack-debug-digest@${this.string}`).toString("hex"); | ||
| return new BulkUpdateDecorator( | ||
| () => /** @type {typeof import("crypto")} */ (crypto).createHash("md4"), | ||
| () => | ||
| /** @type {Hash} */ ( | ||
| /** @type {typeof import("crypto")} */ | ||
| (crypto).createHash("md4") | ||
| ), | ||
| "md4" | ||
@@ -204,3 +271,6 @@ ); | ||
| () => | ||
| /** @type {typeof import("crypto")} */ (crypto).createHash(algorithm), | ||
| /** @type {Hash} */ ( | ||
| /** @type {typeof import("crypto")} */ | ||
| (crypto).createHash(algorithm) | ||
| ), | ||
| algorithm | ||
@@ -207,0 +277,0 @@ ); |
+35
-5
@@ -8,2 +8,4 @@ /* | ||
| /** @typedef {import("../../declarations/WebpackOptions").HashDigest} Encoding */ | ||
| class Hash { | ||
@@ -14,6 +16,21 @@ /* istanbul ignore next */ | ||
| * @abstract | ||
| * @param {string|Buffer} data data | ||
| * @param {string=} inputEncoding data encoding | ||
| * @returns {this} updated hash | ||
| * @overload | ||
| * @param {string | Buffer} data data | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @abstract | ||
| * @overload | ||
| * @param {string} data data | ||
| * @param {Encoding} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @abstract | ||
| * @param {string | Buffer} data data | ||
| * @param {Encoding=} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| update(data, inputEncoding) { | ||
@@ -29,5 +46,18 @@ const AbstractMethodError = require("../AbstractMethodError"); | ||
| * @abstract | ||
| * @param {string=} encoding encoding of the return value | ||
| * @returns {string|Buffer} digest | ||
| * @overload | ||
| * @returns {Buffer} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @abstract | ||
| * @overload | ||
| * @param {Encoding} encoding encoding of the return value | ||
| * @returns {string} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @abstract | ||
| * @param {Encoding=} encoding encoding of the return value | ||
| * @returns {string | Buffer} digest | ||
| */ | ||
| digest(encoding) { | ||
@@ -34,0 +64,0 @@ const AbstractMethodError = require("../AbstractMethodError"); |
@@ -11,2 +11,4 @@ /* | ||
| /** @typedef {import("../../../declarations/WebpackOptions").HashDigest} Encoding */ | ||
| class BatchedHash extends Hash { | ||
@@ -25,6 +27,19 @@ /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @param {string|Buffer} data data | ||
| * @param {string=} inputEncoding data encoding | ||
| * @returns {this} updated hash | ||
| * @overload | ||
| * @param {string | Buffer} data data | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @overload | ||
| * @param {string} data data | ||
| * @param {Encoding} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @param {string | Buffer} data data | ||
| * @param {Encoding=} inputEncoding data encoding | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| update(data, inputEncoding) { | ||
@@ -40,3 +55,7 @@ if (this.string !== undefined) { | ||
| } | ||
| this.hash.update(this.string, this.encoding); | ||
| if (this.encoding) { | ||
| this.hash.update(this.string, this.encoding); | ||
| } else { | ||
| this.hash.update(this.string); | ||
| } | ||
| this.string = undefined; | ||
@@ -52,4 +71,6 @@ } | ||
| this.encoding = inputEncoding; | ||
| } else if (inputEncoding) { | ||
| this.hash.update(data, inputEncoding); | ||
| } else { | ||
| this.hash.update(data, inputEncoding); | ||
| this.hash.update(data); | ||
| } | ||
@@ -64,9 +85,27 @@ } else { | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @param {string=} encoding encoding of the return value | ||
| * @returns {string|Buffer} digest | ||
| * @overload | ||
| * @returns {Buffer} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @overload | ||
| * @param {Encoding} encoding encoding of the return value | ||
| * @returns {string} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @param {Encoding=} encoding encoding of the return value | ||
| * @returns {string | Buffer} digest | ||
| */ | ||
| digest(encoding) { | ||
| if (this.string !== undefined) { | ||
| this.hash.update(this.string, this.encoding); | ||
| if (this.encoding) { | ||
| this.hash.update(this.string, this.encoding); | ||
| } else { | ||
| this.hash.update(this.string); | ||
| } | ||
| } | ||
| if (!encoding) { | ||
| return this.hash.digest(); | ||
| } | ||
| return this.hash.digest(encoding); | ||
@@ -73,0 +112,0 @@ } |
@@ -8,2 +8,4 @@ /* | ||
| const Hash = require("../Hash"); | ||
| // 65536 is the size of a wasm memory page | ||
@@ -15,3 +17,3 @@ // 64 is the maximum chunk size for every possible wasm hash implementation | ||
| class WasmHash { | ||
| class WasmHash extends Hash { | ||
| /** | ||
@@ -24,2 +26,4 @@ * @param {WebAssembly.Instance} instance wasm instance | ||
| constructor(instance, instancesPool, chunkSize, digestSize) { | ||
| super(); | ||
| const exports = /** @type {EXPECTED_ANY} */ (instance.exports); | ||
@@ -41,13 +45,35 @@ exports.init(); | ||
| /** | ||
| * @param {Buffer | string} data data | ||
| * @param {BufferEncoding=} encoding encoding | ||
| * @returns {this} itself | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @overload | ||
| * @param {string | Buffer} data data | ||
| * @returns {Hash} updated hash | ||
| */ | ||
| update(data, encoding) { | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @overload | ||
| * @param {string} data data | ||
| * @param {string=} inputEncoding data encoding | ||
| * @returns {this} updated hash | ||
| */ | ||
| /** | ||
| * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | ||
| * @param {string | Buffer} data data | ||
| * @param {string=} inputEncoding data encoding | ||
| * @returns {this} updated hash | ||
| */ | ||
| update(data, inputEncoding) { | ||
| if (typeof data === "string") { | ||
| while (data.length > MAX_SHORT_STRING) { | ||
| this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding); | ||
| this._updateWithShortString( | ||
| data.slice(0, MAX_SHORT_STRING), | ||
| /** @type {NodeJS.BufferEncoding} */ | ||
| (inputEncoding) | ||
| ); | ||
| data = data.slice(MAX_SHORT_STRING); | ||
| } | ||
| this._updateWithShortString(data, encoding); | ||
| this._updateWithShortString( | ||
| data, | ||
| /** @type {NodeJS.BufferEncoding} */ | ||
| (inputEncoding) | ||
| ); | ||
| return this; | ||
@@ -143,6 +169,18 @@ } | ||
| /** | ||
| * @param {BufferEncoding} type type | ||
| * @returns {Buffer | string} digest | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @overload | ||
| * @returns {Buffer} digest | ||
| */ | ||
| digest(type) { | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @overload | ||
| * @param {string=} encoding encoding of the return value | ||
| * @returns {string} digest | ||
| */ | ||
| /** | ||
| * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | ||
| * @param {string=} encoding encoding of the return value | ||
| * @returns {string | Buffer} digest | ||
| */ | ||
| digest(encoding) { | ||
| const { exports, buffered, mem, digestSize } = this; | ||
@@ -152,5 +190,7 @@ exports.final(buffered); | ||
| const hex = mem.toString("latin1", 0, digestSize); | ||
| if (type === "hex") return hex; | ||
| if (type === "binary" || !type) return Buffer.from(hex, "hex"); | ||
| return Buffer.from(hex, "hex").toString(type); | ||
| if (encoding === "hex") return hex; | ||
| if (encoding === "binary" || !encoding) return Buffer.from(hex, "hex"); | ||
| return Buffer.from(hex, "hex").toString( | ||
| /** @type {NodeJS.BufferEncoding} */ (encoding) | ||
| ); | ||
| } | ||
@@ -157,0 +197,0 @@ } |
@@ -30,11 +30,2 @@ /* | ||
| /** | ||
| * @param {{}=} options parser options | ||
| */ | ||
| constructor(options) { | ||
| super(); | ||
| this.hooks = Object.freeze({}); | ||
| this.options = options; | ||
| } | ||
| /** | ||
| * @param {string | Buffer | PreparsedAst} source the source to parse | ||
@@ -41,0 +32,0 @@ * @param {ParserState} state the parser state |
@@ -67,11 +67,2 @@ /* | ||
| /** | ||
| * @param {{}=} options parser options | ||
| */ | ||
| constructor(options) { | ||
| super(); | ||
| this.hooks = Object.freeze({}); | ||
| this.options = options; | ||
| } | ||
| /** | ||
| * @param {string | Buffer | PreparsedAst} source the source to parse | ||
@@ -78,0 +69,0 @@ * @param {ParserState} state the parser state |
@@ -72,3 +72,3 @@ /* | ||
| } | ||
| return `${RuntimeGlobals.baseURI} = (document && document.baseURI) || self.location.href;`; | ||
| return `${RuntimeGlobals.baseURI} = (typeof document !== 'undefined' && document.baseURI) || self.location.href;`; | ||
| } | ||
@@ -75,0 +75,0 @@ |
+18
-18
| { | ||
| "name": "webpack", | ||
| "version": "5.102.0", | ||
| "version": "5.102.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.", | ||
@@ -92,3 +92,3 @@ "homepage": "https://github.com/webpack/webpack", | ||
| "acorn-import-phases": "^1.0.3", | ||
| "browserslist": "^4.24.5", | ||
| "browserslist": "^4.26.3", | ||
| "chrome-trace-event": "^1.0.2", | ||
@@ -105,4 +105,4 @@ "enhanced-resolve": "^5.17.3", | ||
| "neo-async": "^2.6.2", | ||
| "schema-utils": "^4.3.2", | ||
| "tapable": "^2.2.3", | ||
| "schema-utils": "^4.3.3", | ||
| "tapable": "^2.3.0", | ||
| "terser-webpack-plugin": "^5.3.11", | ||
@@ -115,6 +115,6 @@ "watchpack": "^2.4.4", | ||
| "@babel/preset-react": "^7.27.1", | ||
| "@codspeed/core": "^4.0.1", | ||
| "@eslint/js": "^9.29.0", | ||
| "@eslint/markdown": "^7.1.0", | ||
| "@stylistic/eslint-plugin": "^5.2.2", | ||
| "@codspeed/core": "^5.0.1", | ||
| "@eslint/js": "^9.36.0", | ||
| "@eslint/markdown": "^7.3.0", | ||
| "@stylistic/eslint-plugin": "^5.4.0", | ||
| "@types/glob-to-regexp": "^0.4.4", | ||
@@ -124,5 +124,5 @@ "@types/graceful-fs": "^4.1.9", | ||
| "@types/mime-types": "^2.1.4", | ||
| "@types/node": "^24.1.0", | ||
| "@types/node": "^24.5.2", | ||
| "@types/xxhashjs": "^0.2.4", | ||
| "assemblyscript": "^0.28.5", | ||
| "assemblyscript": "^0.28.8", | ||
| "babel-loader": "^10.0.0", | ||
@@ -138,3 +138,3 @@ "bundle-loader": "^0.5.6", | ||
| "es6-promise-polyfill": "^1.2.0", | ||
| "eslint": "^9.29.0", | ||
| "eslint": "^9.36.0", | ||
| "eslint-config-prettier": "^10.1.1", | ||
@@ -145,3 +145,3 @@ "eslint-config-webpack": "^4.5.1", | ||
| "eslint-plugin-jsdoc": "^51.2.3", | ||
| "eslint-plugin-n": "^17.21.0", | ||
| "eslint-plugin-n": "^17.23.1", | ||
| "eslint-plugin-prettier": "^5.5.0", | ||
@@ -155,7 +155,7 @@ "eslint-plugin-unicorn": "^61.0.1", | ||
| "istanbul": "^0.4.5", | ||
| "jest": "^30.1.2", | ||
| "jest-circus": "^30.1.2", | ||
| "jest-cli": "^30.1.2", | ||
| "jest-diff": "^30.1.2", | ||
| "jest-environment-node": "^30.1.2", | ||
| "jest": "^30.2.0", | ||
| "jest-circus": "^30.2.0", | ||
| "jest-cli": "^30.2.0", | ||
| "jest-diff": "^30.2.0", | ||
| "jest-environment-node": "^30.2.0", | ||
| "jest-junit": "^16.0.0", | ||
@@ -194,3 +194,3 @@ "json-loader": "^0.5.7", | ||
| "ts-loader": "^9.5.1", | ||
| "typescript": "^5.9.2", | ||
| "typescript": "^5.9.3", | ||
| "url-loader": "^4.1.0", | ||
@@ -197,0 +197,0 @@ "wast-loader": "^1.12.1", |
| /* | ||
| * This file was automatically generated. | ||
| * DO NOT MODIFY BY HAND. | ||
| * Run `yarn fix:special` to update | ||
| */ | ||
| declare const check: (options: import("../../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions) => boolean; | ||
| export = check; |
| /* | ||
| * This file was automatically generated. | ||
| * DO NOT MODIFY BY HAND. | ||
| * Run `yarn fix:special` to update | ||
| */ | ||
| const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function e(r,{instancePath:s="",parentData:n,parentDataProperty:a,rootData:i=r}={}){let o=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const s=l;for(const t in r)if("context"!==t&&"hashDigest"!==t&&"hashDigestLength"!==t&&"hashFunction"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(s===l){if(void 0!==r.context){let s=r.context;const n=l;if(l===n){if("string"!=typeof s)return e.errors=[{params:{type:"string"}}],!1;if(s.includes("!")||!0!==t.test(s))return e.errors=[{params:{}}],!1}var u=n===l}else u=!0;if(u){if(void 0!==r.hashDigest){let t=r.hashDigest;const s=l;if("hex"!==t&&"latin1"!==t&&"base64"!==t)return e.errors=[{params:{}}],!1;u=s===l}else u=!0;if(u){if(void 0!==r.hashDigestLength){let t=r.hashDigestLength;const s=l;if(l===s){if("number"!=typeof t)return e.errors=[{params:{type:"number"}}],!1;if(t<1||isNaN(t))return e.errors=[{params:{comparison:">=",limit:1}}],!1}u=s===l}else u=!0;if(u)if(void 0!==r.hashFunction){let t=r.hashFunction;const s=l,n=l;let a=!1,i=null;const p=l,h=l;let c=!1;const m=l;if(l===m)if("string"==typeof t){if(t.length<1){const t={params:{}};null===o?o=[t]:o.push(t),l++}}else{const t={params:{type:"string"}};null===o?o=[t]:o.push(t),l++}var f=m===l;if(c=c||f,!c){const e=l;if(!(t instanceof Function)){const t={params:{}};null===o?o=[t]:o.push(t),l++}f=e===l,c=c||f}if(c)l=h,null!==o&&(h?o.length=h:o=null);else{const t={params:{}};null===o?o=[t]:o.push(t),l++}if(p===l&&(a=!0,i=0),!a){const t={params:{passingSchemas:i}};return null===o?o=[t]:o.push(t),l++,e.errors=o,!1}l=n,null!==o&&(n?o.length=n:o=null),u=s===l}else u=!0}}}}}return e.errors=o,0===l}module.exports=e,module.exports.default=e; |
| { | ||
| "definitions": { | ||
| "HashFunction": { | ||
| "description": "Algorithm used for generation the hash (see node.js crypto package).", | ||
| "anyOf": [ | ||
| { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| { | ||
| "instanceof": "Function", | ||
| "tsType": "typeof import('../../lib/util/Hash')" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "title": "HashedModuleIdsPluginOptions", | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "context": { | ||
| "description": "The context directory for creating names.", | ||
| "type": "string", | ||
| "absolutePath": true | ||
| }, | ||
| "hashDigest": { | ||
| "description": "The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.", | ||
| "enum": ["hex", "latin1", "base64"] | ||
| }, | ||
| "hashDigestLength": { | ||
| "description": "The prefix length of the hash digest to use, defaults to 4.", | ||
| "type": "number", | ||
| "minimum": 1 | ||
| }, | ||
| "hashFunction": { | ||
| "description": "The hashing algorithm to use, defaults to 'md4'. All functions from Node.JS' crypto.createHash are supported.", | ||
| "oneOf": [ | ||
| { | ||
| "$ref": "#/definitions/HashFunction" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
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
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 5 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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify 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 5 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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify 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
5549486
0.43%158933
0.42%225
0.45%Updated
Updated
Updated