@rushstack/webpack5-module-minifier-plugin 5.6.1 → 5.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +42 -0
- package/CHANGELOG.md +11 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/GenerateLicenseFileForAsset.d.ts.map +1 -1
- package/lib/GenerateLicenseFileForAsset.js.map +1 -1
- package/lib/RehydrateAsset.d.ts +1 -2
- package/lib/RehydrateAsset.d.ts.map +1 -1
- package/lib/RehydrateAsset.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/webpack5-module-minifier-plugin",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "5.6.3",
|
|
6
|
+
"tag": "@rushstack/webpack5-module-minifier-plugin_v5.6.3",
|
|
7
|
+
"date": "Fri, 24 Oct 2025 00:13:38 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"dependency": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Updating dependency \"@rushstack/worker-pool\" to `0.6.3`"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.1.3`"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Updating dependency \"@rushstack/module-minifier\" to `0.8.3`"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"comment": "Updating dependency \"@rushstack/module-minifier\" from `*` to `0.8.3`"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"version": "5.6.2",
|
|
27
|
+
"tag": "@rushstack/webpack5-module-minifier-plugin_v5.6.2",
|
|
28
|
+
"date": "Wed, 22 Oct 2025 00:57:54 GMT",
|
|
29
|
+
"comments": {
|
|
30
|
+
"dependency": [
|
|
31
|
+
{
|
|
32
|
+
"comment": "Updating dependency \"@rushstack/worker-pool\" to `0.6.2`"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.1.2`"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"comment": "Updating dependency \"@rushstack/module-minifier\" to `0.8.2`"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"comment": "Updating dependency \"@rushstack/module-minifier\" from `*` to `0.8.2`"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
4
46
|
{
|
|
5
47
|
"version": "5.6.1",
|
|
6
48
|
"tag": "@rushstack/webpack5-module-minifier-plugin_v5.6.1",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Change Log - @rushstack/webpack5-module-minifier-plugin
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 24 Oct 2025 00:13:38 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.6.3
|
|
6
|
+
Fri, 24 Oct 2025 00:13:38 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.6.2
|
|
11
|
+
Wed, 22 Oct 2025 00:57:54 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
4
14
|
|
|
5
15
|
## 5.6.1
|
|
6
16
|
Wed, 08 Oct 2025 00:13:29 GMT
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateLicenseFileForAsset.d.ts","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"GenerateLicenseFileForAsset.d.ts","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AA2B/D;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAqB/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateLicenseFileForAsset.js","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"GenerateLicenseFileForAsset.js","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyC3D,kEAqBC;AA5DD,gDAAkC;AAOlC,SAAS,cAAc,CAAC,OAAyB;;IAC/C,MAAM,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IAE3C,KAAK,MAAM,aAAa,IAAI,OAAO,EAAE,CAAC;QACpC,MAAM,UAAU,GAAqB,CAAC,aAAa,CAAC,OAAO,KAAK,IAAI;YACjE,aAAiD,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,iBAAiB,GAAkC,MACvD,SAAS,CAAC,WAGX,0CAAE,QAAQ,CAAC;YAEZ,IAAI,iBAAiB,EAAE,CAAC;gBACtB,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;oBACxC,MAAM,KAAK,GAAW,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,MAAM,CAAC;oBAClG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,2BAA2B,CAAC,WAAwB,EAAE,KAAiB;IACrF,uCAAuC;IACvC,MAAM,OAAO,GAAqB,WAAW,CAAC,UAAU,CAAC,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9F,MAAM,QAAQ,GAAgB,cAAc,CAAC,OAAO,CAAC,CAAC;IAEtD,MAAM,SAAS,GAAW,KAAK,CAAC,QAAQ,CAAC;IAEzC,IAAI,MAAM,GAAW,EAAE,CAAC;IAExB,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClB,+FAA+F;QAC/F,MAAM,aAAa,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QACpG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,MAAM,eAAe,GAAW,GAAG,SAAS,cAAc,CAAC;QAC3D,WAAW,CAAC,SAAS,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QACtD,MAAM,GAAG,0CAA0C,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC;IAC3F,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport type { Comment } from 'estree';\nimport type { Compilation, Module, sources } from 'webpack';\n\nimport type { IAssetInfo } from './ModuleMinifierPlugin.types';\n\nfunction getAllComments(modules: Iterable<Module>): Set<string> {\n const allComments: Set<string> = new Set();\n\n for (const webpackModule of modules) {\n const submodules: Iterable<Module> = (webpackModule.context === null &&\n (webpackModule as { _modules?: Iterable<Module> })._modules) || [webpackModule];\n for (const submodule of submodules) {\n const subModuleComments: Iterable<Comment> | undefined = (\n submodule.factoryMeta as {\n comments?: Iterable<Comment>;\n }\n )?.comments;\n\n if (subModuleComments) {\n for (const comment of subModuleComments) {\n const value: string = comment.type === 'Line' ? `//${comment.value}\\n` : `/*${comment.value}*/\\n`;\n allComments.add(value);\n }\n }\n }\n }\n\n return allComments;\n}\n\n/**\n * Generates a companion asset containing all extracted comments. If it is non-empty, returns a banner comment directing users to said companion asset.\n *\n * @param compilation - The webpack compilation\n * @param asset - The asset to process\n * @public\n */\nexport function generateLicenseFileForAsset(compilation: Compilation, asset: IAssetInfo): string {\n // Extracted comments from the modules.\n const modules: Iterable<Module> = compilation.chunkGraph.getChunkModulesIterable(asset.chunk);\n const comments: Set<string> = getAllComments(modules);\n\n const assetName: string = asset.fileName;\n\n let banner: string = '';\n\n if (comments.size) {\n // There are license comments in this chunk, so generate the companion file and inject a banner\n const licenseSource: sources.ConcatSource = new compilation.compiler.webpack.sources.ConcatSource();\n comments.forEach((comment) => {\n licenseSource.add(comment);\n });\n const licenseFileName: string = `${assetName}.LICENSE.txt`;\n compilation.emitAsset(licenseFileName, licenseSource);\n banner = `/*! For license information please see ${path.basename(licenseFileName)} */\\n`;\n }\n\n return banner;\n}\n"]}
|
package/lib/RehydrateAsset.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { sources } from 'webpack';
|
|
2
|
-
import type { Compilation } from 'webpack';
|
|
1
|
+
import type { sources, Compilation } from 'webpack';
|
|
3
2
|
import type { IAssetInfo, IModuleMap } from './ModuleMinifierPlugin.types';
|
|
4
3
|
/**
|
|
5
4
|
* Rehydrates an asset with minified modules.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RehydrateAsset.d.ts","sourceRoot":"","sources":["../src/RehydrateAsset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RehydrateAsset.d.ts","sourceRoot":"","sources":["../src/RehydrateAsset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAe,MAAM,8BAA8B,CAAC;AAExF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,OAAO,GACvB,OAAO,CAAC,MAAM,CAwEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RehydrateAsset.js","sourceRoot":"","sources":["../src/RehydrateAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;
|
|
1
|
+
{"version":3,"file":"RehydrateAsset.js","sourceRoot":"","sources":["../src/RehydrateAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAc3D,wCA8EC;AAxFD,2CAAqE;AAGrE;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,WAAwB,EACxB,KAAiB,EACjB,SAAqB,EACrB,MAAc,EACd,cAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,EACJ,OAAO,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EACnC,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEzB,MAAM,SAAS,GAAW,WAAW,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE1D,MAAM,UAAU,GAAW,SAAS,CAAC,OAAO,CAAC,8BAAkB,CAAC,CAAC;IACjE,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,0BAA0B;QAC1B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G,CAAC,YAAY,CAAC,EAAE,EAAE;oBACpC,UAAU;oBACV,UAAU;iBACX,CAAC,CAAC;YACL,CAAC;YAED,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAChC,UAAU,IAAI,UAAU,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,GAAW,oDAAoD,IAAI,OAAO,CAAC;YAE5F,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACxB,UAAU,IAAI,WAAW,CAAC,MAAM,CAAC;QACnC,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjB,UAAU,IAAI,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5F,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAED,kKAAkK;AAClK,SAAS,wBAAwB,CAC/B,wBAAsD,EACtD,MAAsB,EACtB,KAAa,EACb,GAAW;IAEX,MAAM,MAAM,GAA0B,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC3E,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAClC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { sources, Compilation } from 'webpack';\n\nimport { CHUNK_MODULE_TOKEN, CHUNK_MODULE_REGEX } from './Constants';\nimport type { IAssetInfo, IModuleMap, IModuleInfo } from './ModuleMinifierPlugin.types';\n\n/**\n * Rehydrates an asset with minified modules.\n * @param asset - The asset\n * @param moduleMap - The minified modules\n * @param banner - A banner to inject for license information\n * @public\n */\nexport function rehydrateAsset(\n compilation: Compilation,\n asset: IAssetInfo,\n moduleMap: IModuleMap,\n banner: string,\n emitRenderInfo?: boolean\n): sources.Source {\n const { source: assetSource } = asset;\n const {\n webpack: { sources, WebpackError }\n } = compilation.compiler;\n\n const assetCode: string = assetSource.source().toString();\n\n const tokenIndex: number = assetCode.indexOf(CHUNK_MODULE_TOKEN);\n if (tokenIndex < 0) {\n // This is not a JS asset.\n return assetSource;\n }\n\n const { CachedSource, ConcatSource, ReplaceSource } = sources;\n\n CHUNK_MODULE_REGEX.lastIndex = -1;\n let lastStart: number = 0;\n\n const cachedAssetSource: sources.CachedSource = new CachedSource(assetSource);\n\n const source: sources.ConcatSource = new ConcatSource(banner);\n let charOffset: number = banner.length;\n\n // RegExp.exec uses null or an array as the return type, explicitly\n let match: RegExpExecArray | null = null;\n while ((match = CHUNK_MODULE_REGEX.exec(assetCode))) {\n const hash: string = match[1];\n\n const moduleSource: IModuleInfo | undefined = moduleMap.get(hash);\n if (moduleSource === undefined) {\n compilation.errors.push(new WebpackError(`Missing module source for ${hash} in ${asset.fileName}!`));\n }\n\n const separator: sources.ReplaceSource = extractSegmentFromSource(\n ReplaceSource,\n cachedAssetSource,\n lastStart,\n match.index\n );\n\n source.add(separator);\n charOffset += separator.size();\n\n lastStart = CHUNK_MODULE_REGEX.lastIndex;\n\n if (moduleSource) {\n const charLength: number = moduleSource.source.source().length;\n\n if (emitRenderInfo) {\n asset.renderInfo.set(moduleSource.id, {\n charOffset,\n charLength\n });\n }\n\n source.add(moduleSource.source);\n charOffset += charLength;\n } else {\n const errorModule: string = `()=>{throw new Error(\\`Missing module with hash \"${hash}\"\\`)}`;\n\n source.add(errorModule);\n charOffset += errorModule.length;\n }\n\n source.add('\\n');\n charOffset += 1;\n }\n\n source.add(extractSegmentFromSource(ReplaceSource, cachedAssetSource, lastStart, Infinity));\n\n return new CachedSource(source);\n}\n\n// In order to preserve source maps during substitution, have to use a ConcatSource instead of a ReplaceSource, so need to extract the segements from the original\nfunction extractSegmentFromSource(\n replaceSourceConstructor: typeof sources.ReplaceSource,\n source: sources.Source,\n start: number,\n end: number\n): sources.ReplaceSource {\n const result: sources.ReplaceSource = new replaceSourceConstructor(source);\n result.replace(end, Infinity, '');\n result.replace(0, start - 1, '');\n return result;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/webpack5-module-minifier-plugin",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.3",
|
|
4
4
|
"description": "This plugin splits minification of webpack compilations into smaller units.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "dist/webpack5-module-minifier-plugin.d.ts",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"@types/tapable": "1.0.6",
|
|
23
23
|
"@types/estree": "1.0.6",
|
|
24
24
|
"tapable": "2.2.1",
|
|
25
|
-
"@rushstack/worker-pool": "0.6.
|
|
25
|
+
"@rushstack/worker-pool": "0.6.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "20.17.19",
|
|
29
|
-
"eslint": "~9.
|
|
29
|
+
"eslint": "~9.37.0",
|
|
30
30
|
"memfs": "4.12.0",
|
|
31
31
|
"webpack": "~5.98.0",
|
|
32
|
-
"@rushstack/heft": "1.1.
|
|
33
|
-
"
|
|
34
|
-
"
|
|
32
|
+
"@rushstack/heft": "1.1.3",
|
|
33
|
+
"local-node-rig": "1.0.0",
|
|
34
|
+
"@rushstack/module-minifier": "0.8.3"
|
|
35
35
|
},
|
|
36
36
|
"sideEffects": false,
|
|
37
37
|
"peerDependenciesMeta": {
|