@rushstack/webpack4-module-minifier-plugin 0.13.112 → 0.14.0
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 +41 -0
- package/CHANGELOG.md +13 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/GenerateLicenseFileForAsset.d.ts.map +1 -1
- package/lib/GenerateLicenseFileForAsset.js +1 -1
- package/lib/GenerateLicenseFileForAsset.js.map +1 -1
- package/lib/ModuleMinifierPlugin.d.ts.map +1 -1
- package/lib/ModuleMinifierPlugin.js +3 -3
- package/lib/ModuleMinifierPlugin.js.map +1 -1
- package/lib/ModuleMinifierPlugin.types.d.ts +1 -1
- package/lib/ModuleMinifierPlugin.types.d.ts.map +1 -1
- package/lib/ModuleMinifierPlugin.types.js.map +1 -1
- package/lib/OverrideWebpackIdentifierAllocation.js.map +1 -1
- package/lib/ParallelCompiler.js +4 -4
- package/lib/ParallelCompiler.js.map +1 -1
- package/lib/PortableMinifierIdsPlugin.d.ts.map +1 -1
- package/lib/PortableMinifierIdsPlugin.js +2 -2
- package/lib/PortableMinifierIdsPlugin.js.map +1 -1
- package/lib/workerPool/WebpackWorker.d.ts.map +1 -1
- package/lib/workerPool/WebpackWorker.js +1 -1
- package/lib/workerPool/WebpackWorker.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/webpack4-module-minifier-plugin",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.14.0",
|
|
6
|
+
"tag": "@rushstack/webpack4-module-minifier-plugin_v0.14.0",
|
|
7
|
+
"date": "Fri, 03 Oct 2025 20:10:00 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Normalize import of builtin modules to use the `node:` protocol."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@rushstack/module-minifier\" to `0.8.0`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/worker-pool\" to `0.6.0`"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.1.0`"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"version": "0.13.113",
|
|
29
|
+
"tag": "@rushstack/webpack4-module-minifier-plugin_v0.13.113",
|
|
30
|
+
"date": "Tue, 30 Sep 2025 23:57:45 GMT",
|
|
31
|
+
"comments": {
|
|
32
|
+
"dependency": [
|
|
33
|
+
{
|
|
34
|
+
"comment": "Updating dependency \"@rushstack/module-minifier\" to `0.7.30`"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"comment": "Updating dependency \"@rushstack/worker-pool\" to `0.5.30`"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.0.0`"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
4
45
|
{
|
|
5
46
|
"version": "0.13.112",
|
|
6
47
|
"tag": "@rushstack/webpack4-module-minifier-plugin_v0.13.112",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Change Log - @rushstack/webpack4-module-minifier-plugin
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 03 Oct 2025 20:10:00 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.14.0
|
|
6
|
+
Fri, 03 Oct 2025 20:10:00 GMT
|
|
7
|
+
|
|
8
|
+
### Minor changes
|
|
9
|
+
|
|
10
|
+
- Normalize import of builtin modules to use the `node:` protocol.
|
|
11
|
+
|
|
12
|
+
## 0.13.113
|
|
13
|
+
Tue, 30 Sep 2025 23:57:45 GMT
|
|
14
|
+
|
|
15
|
+
_Version update only_
|
|
4
16
|
|
|
5
17
|
## 0.13.112
|
|
6
18
|
Tue, 30 Sep 2025 20:33:51 GMT
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateLicenseFileForAsset.d.ts","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenerateLicenseFileForAsset.d.ts","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAGxC,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAIX,MAAM,8BAA8B,CAAC;AA6BtC;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,WAAW,EAC5C,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,UAAU,GAC1B,MAAM,CAoBR"}
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
})();
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.generateLicenseFileForAsset = generateLicenseFileForAsset;
|
|
39
|
-
const path = __importStar(require("path"));
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
40
|
const webpack_sources_1 = require("webpack-sources");
|
|
41
41
|
function getAllComments(moduleIds, minifiedModules) {
|
|
42
42
|
const allComments = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateLicenseFileForAsset.js","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
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cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAE7E,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,GAAiB,IAAI,8BAAY,EAAE,CAAC;QACvD,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,MAAM,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC;QACpD,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 * as webpack from 'webpack';\nimport { ConcatSource } from 'webpack-sources';\n\nimport type {\n IAssetInfo,\n IModuleMap,\n IModuleInfo,\n IExtendedModule,\n _IAcornComment\n} from './ModuleMinifierPlugin.types';\n\nfunction getAllComments(moduleIds: (string | number)[], minifiedModules: IModuleMap): Set<string> {\n const allComments: Set<string> = new Set();\n\n for (const moduleId of moduleIds) {\n const mod: IModuleInfo | undefined = minifiedModules.get(moduleId);\n if (!mod) {\n continue;\n }\n\n const { module: webpackModule } = mod;\n const modules: IExtendedModule[] = webpackModule.modules || [webpackModule];\n for (const submodule of modules) {\n const { comments: subModuleComments } = submodule.factoryMeta as {\n comments?: Set<_IAcornComment>;\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 * @param minifiedModules - The minified modules to pull comments from\n * @param assetName - The name of the asset\n * @public\n */\nexport function generateLicenseFileForAsset(\n compilation: webpack.compilation.Compilation,\n asset: IAssetInfo,\n minifiedModules: IModuleMap\n): string {\n // Extracted comments from the modules.\n const comments: Set<string> = getAllComments(asset.modules, minifiedModules);\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: ConcatSource = new ConcatSource();\n comments.forEach((comment) => {\n licenseSource.add(comment);\n });\n const licenseFileName: string = `${assetName}.LICENSE.txt`;\n compilation.assets[licenseFileName] = licenseSource;\n banner = `/*! For license information please see ${path.basename(licenseFileName)} */\\n`;\n }\n\n return banner;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleMinifierPlugin.d.ts","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ModuleMinifierPlugin.d.ts","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,KAAK,EAEV,eAAe,EAGhB,MAAM,4BAA4B,CAAC;AAUpC,OAAO,KAAK,EACV,4BAA4B,EAI5B,0BAA0B,EAK1B,0BAA0B,EAE3B,MAAM,8BAA8B,CAAC;AAMtC,OAAO,uCAAuC,CAAC;AA4G/C;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,OAAO,CAAC,MAAM;IACzD,SAAgB,KAAK,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,EAAE,eAAe,CAAC;IAEjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;gBAE/B,OAAO,EAAE,4BAA4B;WAiC1C,wBAAwB,CACpC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,WAAW,GAC3C,0BAA0B,GAAG,SAAS;IAIlC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI;CAkb/C"}
|
|
@@ -36,12 +36,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
})();
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.ModuleMinifierPlugin = void 0;
|
|
39
|
-
const
|
|
39
|
+
const node_crypto_1 = require("node:crypto");
|
|
40
40
|
const webpack_sources_1 = require("webpack-sources");
|
|
41
41
|
const webpack = __importStar(require("webpack"));
|
|
42
42
|
const tapable_1 = require("tapable");
|
|
43
|
-
const Constants_1 = require("./Constants");
|
|
44
43
|
const module_minifier_1 = require("@rushstack/module-minifier");
|
|
44
|
+
const Constants_1 = require("./Constants");
|
|
45
45
|
const GenerateLicenseFileForAsset_1 = require("./GenerateLicenseFileForAsset");
|
|
46
46
|
const RehydrateAsset_1 = require("./RehydrateAsset");
|
|
47
47
|
const AsyncImportCompressionPlugin_1 = require("./AsyncImportCompressionPlugin");
|
|
@@ -77,7 +77,7 @@ function stringifyIdSortPredicate(a, b) {
|
|
|
77
77
|
return 0;
|
|
78
78
|
}
|
|
79
79
|
function hashCodeFragment(code) {
|
|
80
|
-
return (0,
|
|
80
|
+
return (0, node_crypto_1.createHash)('sha256').update(code).digest('hex');
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Base implementation of asset rehydration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleMinifierPlugin.js","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.ts"],"names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AM,CAAC,YAAY,CAAC,CAAC;gBAC1B,mCAAmC;gBACnC,IAAI,kBAAkB,EAAE,CAAC;oBACvB,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;YAED,gEAAgE;YAC/D,WAAW,CAAC,aAAmD,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CACrF,WAAW,EACX,eAAe,CAChB,CAAC;YACF,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;YAE9E,mGAAmG;YAClG,WAAW,CAAC,aAAmD,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAChF,SAAS,EACT,CAAC,MAAc,EAAE,KAAgC,EAAE,cAAuB,EAAE,EAAE;gBAC5E,IAAI,cAAc,KAAK,WAAW,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;oBAC9D,iCAAiC;oBACjC,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,+BAA+B;gBAC/B,OAAO,IAAI,2BAAS,CAAC,+BAAmB,CAAC,CAAC;YAC5C,CAAC,CACF,CAAC;YAED,WAAW,CAAC,YAAkD,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAC/E,SAAS,EACT,CAAC,MAAc,EAAE,KAAgC,EAAE,IAAa,EAAE,cAAuB,EAAE,EAAE;gBAC3F,IAAI,cAAc,KAAK,WAAW,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;oBAC9D,iCAAiC;oBACjC,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,+BAA+B;gBAC/B,OAAO,IAAI,2BAAS,CAAC,+BAAmB,CAAC,CAAC;YAC5C,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAleD,oDAkeC","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 { createHash, type Hash } from 'crypto';\n\nimport {\n CachedSource,\n ConcatSource,\n RawSource,\n ReplaceSource,\n type Source,\n SourceMapSource\n} from 'webpack-sources';\nimport * as webpack from 'webpack';\nimport { AsyncSeriesWaterfallHook, type SyncHook, SyncWaterfallHook, type TapOptions } from 'tapable';\n\nimport {\n CHUNK_MODULES_TOKEN,\n MODULE_WRAPPER_PREFIX,\n MODULE_WRAPPER_SUFFIX,\n STAGE_BEFORE,\n STAGE_AFTER\n} from './Constants';\nimport type {\n IMinifierConnection,\n IModuleMinifier,\n IModuleMinificationResult,\n IModuleMinificationErrorResult\n} from '@rushstack/module-minifier';\nimport { getIdentifier } from '@rushstack/module-minifier';\n\nimport type {\n IModuleMinifierPluginOptions,\n IModuleMap,\n IAssetMap,\n IExtendedModule,\n IModuleMinifierPluginHooks,\n IPostProcessFragmentContext,\n IDehydratedAssets,\n _IWebpackCompilationData,\n _IAcornComment,\n IModuleMinifierPluginStats,\n IAssetStats\n} from './ModuleMinifierPlugin.types';\nimport { generateLicenseFileForAsset } from './GenerateLicenseFileForAsset';\nimport { rehydrateAsset } from './RehydrateAsset';\nimport { AsyncImportCompressionPlugin } from './AsyncImportCompressionPlugin';\nimport { PortableMinifierModuleIdsPlugin } from './PortableMinifierIdsPlugin';\n\nimport './OverrideWebpackIdentifierAllocation';\n\n// The name of the plugin, for use in taps\nconst PLUGIN_NAME: 'ModuleMinifierPlugin' = 'ModuleMinifierPlugin';\n\n// Monotonically increasing identifier to be incremented any time the code generation logic changes\n// Will be applied to the webpack hash.\nconst CODE_GENERATION_REVISION: number = 1;\n\nconst TAP_BEFORE: TapOptions<'promise'> = {\n name: PLUGIN_NAME,\n stage: STAGE_BEFORE\n};\nconst TAP_AFTER: TapOptions<'sync'> = {\n name: PLUGIN_NAME,\n stage: STAGE_AFTER\n};\n\ninterface IExtendedChunkTemplate {\n hooks: {\n hashForChunk: SyncHook<Hash, webpack.compilation.Chunk>;\n modules: SyncWaterfallHook<Source, webpack.compilation.Chunk>;\n };\n}\n\ninterface IExtendedParser extends webpack.compilation.normalModuleFactory.Parser {\n state: {\n module: IExtendedModule;\n };\n}\n\ninterface IExtendedModuleTemplate extends webpack.compilation.ModuleTemplate {\n render: (module: IExtendedModule, dependencyTemplates: unknown, options: unknown) => Source;\n}\n\ninterface IOptionsForHash extends Omit<IModuleMinifierPluginOptions, 'minifier'> {\n revision: number;\n minifier: undefined;\n}\n\nconst compilationMetadataMap: WeakMap<webpack.compilation.Compilation, IModuleMinifierPluginStats> =\n new WeakMap();\n\n/**\n * https://github.com/webpack/webpack/blob/30e747a55d9e796ae22f67445ae42c7a95a6aa48/lib/Template.js#L36-47\n * @param a first id to be sorted\n * @param b second id to be sorted against\n * @returns the sort value\n */\nfunction stringifyIdSortPredicate(a: string | number, b: string | number): -1 | 0 | 1 {\n const aId: string = a + '';\n const bId: string = b + '';\n if (aId < bId) return -1;\n if (aId > bId) return 1;\n return 0;\n}\n\nfunction hashCodeFragment(code: string): string {\n return createHash('sha256').update(code).digest('hex');\n}\n\n/**\n * Base implementation of asset rehydration\n *\n * @param dehydratedAssets The dehydrated assets\n * @param compilation The webpack compilation\n */\nfunction defaultRehydrateAssets(\n dehydratedAssets: IDehydratedAssets,\n compilation: webpack.compilation.Compilation\n): IDehydratedAssets {\n const { assets, modules } = dehydratedAssets;\n\n const compilationMetadata: IModuleMinifierPluginStats | undefined = compilationMetadataMap.get(compilation);\n if (!compilationMetadata) {\n throw new Error(`Could not get compilation metadata`);\n }\n\n const { metadataByAssetFileName } = compilationMetadata;\n\n // Now assets/modules contain fully minified code. Rehydrate.\n for (const [assetName, info] of assets) {\n const banner: string = /\\.m?js(\\?.+)?$/.test(assetName)\n ? generateLicenseFileForAsset(compilation, info, modules)\n : '';\n\n const outputSource: Source = rehydrateAsset(info, modules, banner, true);\n metadataByAssetFileName.set(assetName, {\n positionByModuleId: info.renderInfo\n });\n compilation.assets[assetName] = outputSource;\n }\n\n return dehydratedAssets;\n}\n\nfunction isMinificationResultError(\n result: IModuleMinificationResult\n): result is IModuleMinificationErrorResult {\n return !!result.error;\n}\n\n// Matche behavior of terser's \"some\" option\nfunction isLicenseComment(comment: _IAcornComment): boolean {\n // https://github.com/terser/terser/blob/d3d924fa9e4c57bbe286b811c6068bcc7026e902/lib/output.js#L175\n return /@preserve|@lic|@cc_on|^\\**!/i.test(comment.value);\n}\n\n/**\n * Webpack plugin that minifies code on a per-module basis rather than per-asset. The actual minification is handled by the input `minifier` object.\n * @public\n */\nexport class ModuleMinifierPlugin implements webpack.Plugin {\n public readonly hooks: IModuleMinifierPluginHooks;\n public minifier: IModuleMinifier;\n\n private readonly _enhancers: webpack.Plugin[];\n private readonly _sourceMap: boolean | undefined;\n\n private readonly _optionsForHash: IOptionsForHash;\n\n public constructor(options: IModuleMinifierPluginOptions) {\n this.hooks = {\n rehydrateAssets: new AsyncSeriesWaterfallHook(['dehydratedContent', 'compilation']),\n\n finalModuleId: new SyncWaterfallHook(['id']),\n\n postProcessCodeFragment: new SyncWaterfallHook(['code', 'context'])\n };\n\n const { minifier, sourceMap, usePortableModules = false, compressAsyncImports = false } = options;\n\n this._optionsForHash = {\n ...options,\n minifier: undefined,\n revision: CODE_GENERATION_REVISION\n };\n\n this._enhancers = [];\n\n if (usePortableModules) {\n this._enhancers.push(new PortableMinifierModuleIdsPlugin(this.hooks));\n }\n\n if (compressAsyncImports) {\n this._enhancers.push(new AsyncImportCompressionPlugin(this.hooks));\n }\n\n this.hooks.rehydrateAssets.tap(PLUGIN_NAME, defaultRehydrateAssets);\n this.minifier = minifier;\n\n this._sourceMap = sourceMap;\n }\n\n public static getCompilationStatistics(\n compilation: webpack.compilation.Compilation\n ): IModuleMinifierPluginStats | undefined {\n return compilationMetadataMap.get(compilation);\n }\n\n public apply(compiler: webpack.Compiler): void {\n for (const enhancer of this._enhancers) {\n enhancer.apply(compiler);\n }\n\n const {\n options: { devtool, mode }\n } = compiler;\n // The explicit setting is preferred due to accuracy, but try to guess based on devtool\n const useSourceMaps: boolean =\n typeof this._sourceMap === 'boolean'\n ? this._sourceMap\n : typeof devtool === 'string'\n ? devtool.endsWith('source-map')\n : mode === 'production' && devtool !== false;\n\n this._optionsForHash.sourceMap = useSourceMaps;\n const binaryConfig: Uint8Array = Buffer.from(JSON.stringify(this._optionsForHash), 'utf-8');\n\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: webpack.compilation.Compilation, compilationData: _IWebpackCompilationData) => {\n const { normalModuleFactory } = compilationData;\n\n function addCommentExtraction(parser: webpack.compilation.normalModuleFactory.Parser): void {\n parser.hooks.program.tap(PLUGIN_NAME, (program: unknown, comments: _IAcornComment[]) => {\n (parser as IExtendedParser).state.module.factoryMeta.comments = comments.filter(isLicenseComment);\n });\n }\n\n normalModuleFactory.hooks.parser.for('javascript/auto').tap(PLUGIN_NAME, addCommentExtraction);\n normalModuleFactory.hooks.parser.for('javascript/dynamic').tap(PLUGIN_NAME, addCommentExtraction);\n normalModuleFactory.hooks.parser.for('javascript/esm').tap(PLUGIN_NAME, addCommentExtraction);\n\n /**\n * Set of local module ids that have been processed.\n */\n const submittedModules: Set<string | number> = new Set();\n\n /**\n * The text and comments of all minified modules.\n */\n const minifiedModules: IModuleMap = new Map();\n\n /**\n * The text and comments of all minified chunks. Most of these are trivial, but the runtime chunk is a bit larger.\n */\n const minifiedAssets: IAssetMap = new Map();\n\n const metadataByAssetFileName: Map<string, IAssetStats> = new Map();\n const compilationStatistics: IModuleMinifierPluginStats = {\n metadataByAssetFileName\n };\n compilationMetadataMap.set(compilation, compilationStatistics);\n\n let pendingMinificationRequests: number = 0;\n /**\n * Indicates that all files have been sent to the minifier and therefore that when pending hits 0, assets can be rehydrated.\n */\n let allRequestsIssued: boolean = false;\n\n let resolveMinifyPromise: () => void;\n\n const getRealId: (id: number | string) => number | string | undefined = (id: number | string) =>\n this.hooks.finalModuleId.call(id, compilation);\n\n const postProcessCode: (\n code: ReplaceSource,\n context: IPostProcessFragmentContext\n ) => ReplaceSource = (code: ReplaceSource, context: IPostProcessFragmentContext) =>\n this.hooks.postProcessCodeFragment.call(code, context);\n\n /**\n * Callback to invoke when a file has finished minifying.\n */\n function onFileMinified(): void {\n if (--pendingMinificationRequests === 0 && allRequestsIssued) {\n resolveMinifyPromise();\n }\n }\n\n const { minifier } = this;\n\n let minifierConnection: IMinifierConnection | undefined;\n\n const requestShortener: webpack.compilation.RequestShortener =\n compilation.runtimeTemplate.requestShortener;\n\n /**\n * Extracts the code for the module and sends it to be minified.\n * Currently source maps are explicitly not supported.\n * @param {Source} source\n * @param {Module} mod\n */\n function minifyModule(source: Source, mod: IExtendedModule): Source {\n const id: string | number | null = mod.id;\n\n if (id !== null && !submittedModules.has(id)) {\n // options.chunk contains the current chunk, if needed\n // Render the source, then hash, then persist hash -> module, return a placeholder\n\n // Initially populate the map with unminified version; replace during callback\n submittedModules.add(id);\n\n const realId: string | number | undefined = getRealId(id);\n\n if (realId !== undefined && !mod.factoryMeta.skipMinification) {\n const wrapped: ConcatSource = new ConcatSource(\n MODULE_WRAPPER_PREFIX + '\\n',\n source,\n '\\n' + MODULE_WRAPPER_SUFFIX\n );\n\n const nameForMap: string = `(modules)/${realId}`;\n\n const { source: wrappedCode, map } = useSourceMaps\n ? wrapped.sourceAndMap()\n : {\n source: wrapped.source(),\n map: undefined\n };\n\n const hash: string = hashCodeFragment(wrappedCode);\n\n ++pendingMinificationRequests;\n\n minifier.minify(\n {\n hash,\n code: wrappedCode,\n nameForMap: useSourceMaps ? nameForMap : undefined,\n externals: undefined\n },\n (result: IModuleMinificationResult) => {\n if (isMinificationResultError(result)) {\n compilation.errors.push(result.error);\n } else {\n try {\n // Have the source map display the module id instead of the minifier boilerplate\n const sourceForMap: string = `// ${mod.readableIdentifier(\n requestShortener\n )}${wrappedCode.slice(MODULE_WRAPPER_PREFIX.length, -MODULE_WRAPPER_SUFFIX.length)}`;\n\n const { code: minified, map: minifierMap } = result;\n\n const rawOutput: Source = useSourceMaps\n ? new SourceMapSource(\n minified, // Code\n nameForMap, // File\n minifierMap!, // Base source map\n sourceForMap, // Source from before transform\n map!, // Source Map from before transform\n false // Remove original source\n )\n : new RawSource(minified);\n\n const unwrapped: ReplaceSource = new ReplaceSource(rawOutput);\n const len: number = minified.length;\n\n unwrapped.replace(0, MODULE_WRAPPER_PREFIX.length - 1, '');\n unwrapped.replace(len - MODULE_WRAPPER_SUFFIX.length, len - 1, '');\n\n const withIds: Source = postProcessCode(unwrapped, {\n compilation,\n module: mod,\n loggingName: mod.identifier()\n });\n const cached: CachedSource = new CachedSource(withIds);\n\n const minifiedSize: number = Buffer.byteLength(cached.source(), 'utf-8');\n mod.factoryMeta.minifiedSize = minifiedSize;\n\n minifiedModules.set(realId, {\n source: cached,\n module: mod\n });\n } catch (err) {\n compilation.errors.push(err);\n }\n }\n\n onFileMinified();\n }\n );\n } else {\n // Route any other modules straight through\n const cached: CachedSource = new CachedSource(\n postProcessCode(new ReplaceSource(source), {\n compilation,\n module: mod,\n loggingName: mod.identifier()\n })\n );\n\n const minifiedSize: number = Buffer.byteLength(cached.source(), 'utf-8');\n mod.factoryMeta.minifiedSize = minifiedSize;\n\n minifiedModules.set(realId !== undefined ? realId : id, {\n source: cached,\n module: mod\n });\n }\n }\n\n // Return something so that this stage still produces valid ECMAScript\n return new RawSource('(function(){})');\n }\n\n const jsTemplate: IExtendedModuleTemplate = compilation.moduleTemplates\n .javascript as IExtendedModuleTemplate;\n const innerRender: IExtendedModuleTemplate['render'] = jsTemplate.render.bind(jsTemplate);\n\n // The optimizeTree hook is the last async hook that occurs before chunk rendering\n compilation.hooks.optimizeTree.tapPromise(PLUGIN_NAME, async () => {\n minifierConnection = await minifier.connectAsync();\n\n submittedModules.clear();\n\n const cache: WeakSet<IExtendedModule> = new WeakSet();\n const defaultSource: Source = new RawSource('');\n\n // During code generation, send the generated code to the minifier and replace with a placeholder\n // Hacking this to avoid calling .source() on a concatenated module multiple times\n jsTemplate.render = (module: IExtendedModule, dependencyTemplates, options) => {\n if (!cache.has(module)) {\n cache.add(module);\n const rendered: Source = innerRender(module, dependencyTemplates, options);\n\n minifyModule(rendered, module);\n }\n\n return defaultSource;\n };\n });\n\n // This should happen before any other tasks that operate during optimizeChunkAssets\n compilation.hooks.optimizeChunkAssets.tapPromise(\n TAP_BEFORE,\n async (chunks: webpack.compilation.Chunk[]): Promise<void> => {\n // Still need to minify the rendered assets\n for (const chunk of chunks) {\n const externals: string[] = [];\n const externalNames: Map<string, string> = new Map();\n\n const chunkModuleSet: Set<string | number> = new Set();\n const allChunkModules: Iterable<IExtendedModule> =\n chunk.modulesIterable as Iterable<IExtendedModule>;\n let hasNonNumber: boolean = false;\n for (const mod of allChunkModules) {\n if (mod.id !== null) {\n if (typeof mod.id !== 'number') {\n hasNonNumber = true;\n }\n chunkModuleSet.add(mod.id);\n\n if (mod.external) {\n // Match the identifiers generated in the AmdMainTemplatePlugin\n // https://github.com/webpack/webpack/blob/444e59f8a427f94f0064cae6765e5a3c4b78596d/lib/AmdMainTemplatePlugin.js#L49\n const key: string = `__WEBPACK_EXTERNAL_MODULE_${webpack.Template.toIdentifier(\n `${mod.id}`\n )}__`;\n // The first two identifiers are used for function (module, exports) at the module site\n const ordinal: number = 2 + externals.length;\n const miniId: string = getIdentifier(ordinal);\n externals.push(key);\n externalNames.set(key, miniId);\n }\n }\n }\n\n const chunkModules: (string | number)[] = Array.from(chunkModuleSet);\n // Sort by id before rehydration in case we rehydrate a given chunk multiple times\n chunkModules.sort(\n hasNonNumber\n ? stringifyIdSortPredicate\n : (x: string | number, y: string | number) => (x as number) - (y as number)\n );\n\n for (const assetName of chunk.files) {\n const asset: Source = compilation.assets[assetName];\n\n // Verify that this is a JS asset\n if (/\\.m?js(\\?.+)?$/.test(assetName)) {\n ++pendingMinificationRequests;\n\n const rawCode: string = asset.source() as string;\n const nameForMap: string = `(chunks)/${assetName}`;\n\n const hash: string = hashCodeFragment(rawCode);\n\n minifier.minify(\n {\n hash,\n code: rawCode,\n nameForMap: useSourceMaps ? nameForMap : undefined,\n externals\n },\n (result: IModuleMinificationResult) => {\n if (isMinificationResultError(result)) {\n compilation.errors.push(result.error);\n // eslint-disable-next-line no-console\n console.error(result.error);\n } else {\n try {\n const { code: minified, map: minifierMap } = result;\n\n let codeForMap: string = rawCode;\n if (useSourceMaps) {\n // Pretend the __WEBPACK_CHUNK_MODULES__ token is an array of module ids, so that the source map contains information about the module ids in the chunk\n codeForMap = codeForMap.replace(\n CHUNK_MODULES_TOKEN,\n JSON.stringify(chunkModules, undefined, 2)\n );\n }\n\n const rawOutput: Source = useSourceMaps\n ? new SourceMapSource(\n minified, // Code\n nameForMap, // File\n minifierMap!, // Base source map\n codeForMap, // Source from before transform\n undefined, // Source Map from before transform\n false // Remove original source\n )\n : new RawSource(minified);\n\n const withIds: Source = postProcessCode(new ReplaceSource(rawOutput), {\n compilation,\n module: undefined,\n loggingName: assetName\n });\n\n minifiedAssets.set(assetName, {\n source: new CachedSource(withIds),\n modules: chunkModules,\n chunk,\n fileName: assetName,\n renderInfo: new Map(),\n externalNames\n });\n } catch (err) {\n compilation.errors.push(err);\n }\n }\n\n onFileMinified();\n }\n );\n } else {\n // This isn't a JS asset. Don't try to minify the asset wrapper, though if it contains modules, those might still get replaced with minified versions.\n minifiedAssets.set(assetName, {\n // Still need to restore ids\n source: postProcessCode(new ReplaceSource(asset), {\n compilation,\n module: undefined,\n loggingName: assetName\n }),\n modules: chunkModules,\n chunk,\n fileName: assetName,\n renderInfo: new Map(),\n externalNames\n });\n }\n }\n }\n\n allRequestsIssued = true;\n\n if (pendingMinificationRequests) {\n await new Promise<void>((resolve) => {\n resolveMinifyPromise = resolve;\n });\n }\n\n // Handle any error from the minifier.\n await minifierConnection?.disconnectAsync();\n\n // All assets and modules have been minified, hand them off to be rehydrated\n await this.hooks.rehydrateAssets.promise(\n {\n assets: minifiedAssets,\n modules: minifiedModules\n },\n compilation\n );\n }\n );\n\n function updateChunkHash(hash: Hash, chunk: webpack.compilation.Chunk): void {\n // Apply the options hash\n hash.update(binaryConfig);\n // Apply the hash from the minifier\n if (minifierConnection) {\n hash.update(minifierConnection.configHash, 'utf8');\n }\n }\n\n // Need to update chunk hashes with information from this plugin\n (compilation.chunkTemplate as unknown as IExtendedChunkTemplate).hooks.hashForChunk.tap(\n PLUGIN_NAME,\n updateChunkHash\n );\n compilation.mainTemplate.hooks.hashForChunk.tap(PLUGIN_NAME, updateChunkHash);\n\n // This function is written twice because the parameter order is not the same between the two hooks\n (compilation.chunkTemplate as unknown as IExtendedChunkTemplate).hooks.modules.tap(\n TAP_AFTER,\n (source: Source, chunk: webpack.compilation.Chunk, moduleTemplate: unknown) => {\n if (moduleTemplate !== compilation.moduleTemplates.javascript) {\n // This is not a JavaScript asset\n return source;\n }\n\n // Discard the rendered modules\n return new RawSource(CHUNK_MODULES_TOKEN);\n }\n );\n\n (compilation.mainTemplate as unknown as IExtendedChunkTemplate).hooks.modules.tap(\n TAP_AFTER,\n (source: Source, chunk: webpack.compilation.Chunk, hash: unknown, moduleTemplate: unknown) => {\n if (moduleTemplate !== compilation.moduleTemplates.javascript) {\n // This is not a JavaScript asset\n return source;\n }\n\n // Discard the rendered modules\n return new RawSource(CHUNK_MODULES_TOKEN);\n }\n );\n }\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ModuleMinifierPlugin.js","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,6CAAoD;AAEpD,qDAOyB;AACzB,iDAAmC;AACnC,qCAAsG;AAQtG,gEAA2D;AAE3D,2CAMqB;AAcrB,+EAA4E;AAC5E,qDAAkD;AAClD,iFAA8E;AAC9E,2EAA8E;AAE9E,iDAA+C;AAE/C,0CAA0C;AAC1C,MAAM,WAAW,GAA2B,sBAAsB,CAAC;AAEnE,mGAAmG;AACnG,uCAAuC;AACvC,MAAM,wBAAwB,GAAW,CAAC,CAAC;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,CAAC;YAE9E,mGAAmG;YAClG,WAAW,CAAC,aAAmD,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAChF,SAAS,EACT,CAAC,MAAc,EAAE,KAAgC,EAAE,cAAuB,EAAE,EAAE;gBAC5E,IAAI,cAAc,KAAK,WAAW,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;oBAC9D,iCAAiC;oBACjC,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,+BAA+B;gBAC/B,OAAO,IAAI,2BAAS,CAAC,+BAAmB,CAAC,CAAC;YAC5C,CAAC,CACF,CAAC;YAED,WAAW,CAAC,YAAkD,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAC/E,SAAS,EACT,CAAC,MAAc,EAAE,KAAgC,EAAE,IAAa,EAAE,cAAuB,EAAE,EAAE;gBAC3F,IAAI,cAAc,KAAK,WAAW,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;oBAC9D,iCAAiC;oBACjC,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,+BAA+B;gBAC/B,OAAO,IAAI,2BAAS,CAAC,+BAAmB,CAAC,CAAC;YAC5C,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAleD,oDAkeC","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 { createHash, type Hash } from 'node:crypto';\n\nimport {\n CachedSource,\n ConcatSource,\n RawSource,\n ReplaceSource,\n type Source,\n SourceMapSource\n} from 'webpack-sources';\nimport * as webpack from 'webpack';\nimport { AsyncSeriesWaterfallHook, type SyncHook, SyncWaterfallHook, type TapOptions } from 'tapable';\n\nimport type {\n IMinifierConnection,\n IModuleMinifier,\n IModuleMinificationResult,\n IModuleMinificationErrorResult\n} from '@rushstack/module-minifier';\nimport { getIdentifier } from '@rushstack/module-minifier';\n\nimport {\n CHUNK_MODULES_TOKEN,\n MODULE_WRAPPER_PREFIX,\n MODULE_WRAPPER_SUFFIX,\n STAGE_BEFORE,\n STAGE_AFTER\n} from './Constants';\nimport type {\n IModuleMinifierPluginOptions,\n IModuleMap,\n IAssetMap,\n IExtendedModule,\n IModuleMinifierPluginHooks,\n IPostProcessFragmentContext,\n IDehydratedAssets,\n _IWebpackCompilationData,\n _IAcornComment,\n IModuleMinifierPluginStats,\n IAssetStats\n} from './ModuleMinifierPlugin.types';\nimport { generateLicenseFileForAsset } from './GenerateLicenseFileForAsset';\nimport { rehydrateAsset } from './RehydrateAsset';\nimport { AsyncImportCompressionPlugin } from './AsyncImportCompressionPlugin';\nimport { PortableMinifierModuleIdsPlugin } from './PortableMinifierIdsPlugin';\n\nimport './OverrideWebpackIdentifierAllocation';\n\n// The name of the plugin, for use in taps\nconst PLUGIN_NAME: 'ModuleMinifierPlugin' = 'ModuleMinifierPlugin';\n\n// Monotonically increasing identifier to be incremented any time the code generation logic changes\n// Will be applied to the webpack hash.\nconst CODE_GENERATION_REVISION: number = 1;\n\nconst TAP_BEFORE: TapOptions<'promise'> = {\n name: PLUGIN_NAME,\n stage: STAGE_BEFORE\n};\nconst TAP_AFTER: TapOptions<'sync'> = {\n name: PLUGIN_NAME,\n stage: STAGE_AFTER\n};\n\ninterface IExtendedChunkTemplate {\n hooks: {\n hashForChunk: SyncHook<Hash, webpack.compilation.Chunk>;\n modules: SyncWaterfallHook<Source, webpack.compilation.Chunk>;\n };\n}\n\ninterface IExtendedParser extends webpack.compilation.normalModuleFactory.Parser {\n state: {\n module: IExtendedModule;\n };\n}\n\ninterface IExtendedModuleTemplate extends webpack.compilation.ModuleTemplate {\n render: (module: IExtendedModule, dependencyTemplates: unknown, options: unknown) => Source;\n}\n\ninterface IOptionsForHash extends Omit<IModuleMinifierPluginOptions, 'minifier'> {\n revision: number;\n minifier: undefined;\n}\n\nconst compilationMetadataMap: WeakMap<webpack.compilation.Compilation, IModuleMinifierPluginStats> =\n new WeakMap();\n\n/**\n * https://github.com/webpack/webpack/blob/30e747a55d9e796ae22f67445ae42c7a95a6aa48/lib/Template.js#L36-47\n * @param a first id to be sorted\n * @param b second id to be sorted against\n * @returns the sort value\n */\nfunction stringifyIdSortPredicate(a: string | number, b: string | number): -1 | 0 | 1 {\n const aId: string = a + '';\n const bId: string = b + '';\n if (aId < bId) return -1;\n if (aId > bId) return 1;\n return 0;\n}\n\nfunction hashCodeFragment(code: string): string {\n return createHash('sha256').update(code).digest('hex');\n}\n\n/**\n * Base implementation of asset rehydration\n *\n * @param dehydratedAssets The dehydrated assets\n * @param compilation The webpack compilation\n */\nfunction defaultRehydrateAssets(\n dehydratedAssets: IDehydratedAssets,\n compilation: webpack.compilation.Compilation\n): IDehydratedAssets {\n const { assets, modules } = dehydratedAssets;\n\n const compilationMetadata: IModuleMinifierPluginStats | undefined = compilationMetadataMap.get(compilation);\n if (!compilationMetadata) {\n throw new Error(`Could not get compilation metadata`);\n }\n\n const { metadataByAssetFileName } = compilationMetadata;\n\n // Now assets/modules contain fully minified code. Rehydrate.\n for (const [assetName, info] of assets) {\n const banner: string = /\\.m?js(\\?.+)?$/.test(assetName)\n ? generateLicenseFileForAsset(compilation, info, modules)\n : '';\n\n const outputSource: Source = rehydrateAsset(info, modules, banner, true);\n metadataByAssetFileName.set(assetName, {\n positionByModuleId: info.renderInfo\n });\n compilation.assets[assetName] = outputSource;\n }\n\n return dehydratedAssets;\n}\n\nfunction isMinificationResultError(\n result: IModuleMinificationResult\n): result is IModuleMinificationErrorResult {\n return !!result.error;\n}\n\n// Matche behavior of terser's \"some\" option\nfunction isLicenseComment(comment: _IAcornComment): boolean {\n // https://github.com/terser/terser/blob/d3d924fa9e4c57bbe286b811c6068bcc7026e902/lib/output.js#L175\n return /@preserve|@lic|@cc_on|^\\**!/i.test(comment.value);\n}\n\n/**\n * Webpack plugin that minifies code on a per-module basis rather than per-asset. The actual minification is handled by the input `minifier` object.\n * @public\n */\nexport class ModuleMinifierPlugin implements webpack.Plugin {\n public readonly hooks: IModuleMinifierPluginHooks;\n public minifier: IModuleMinifier;\n\n private readonly _enhancers: webpack.Plugin[];\n private readonly _sourceMap: boolean | undefined;\n\n private readonly _optionsForHash: IOptionsForHash;\n\n public constructor(options: IModuleMinifierPluginOptions) {\n this.hooks = {\n rehydrateAssets: new AsyncSeriesWaterfallHook(['dehydratedContent', 'compilation']),\n\n finalModuleId: new SyncWaterfallHook(['id']),\n\n postProcessCodeFragment: new SyncWaterfallHook(['code', 'context'])\n };\n\n const { minifier, sourceMap, usePortableModules = false, compressAsyncImports = false } = options;\n\n this._optionsForHash = {\n ...options,\n minifier: undefined,\n revision: CODE_GENERATION_REVISION\n };\n\n this._enhancers = [];\n\n if (usePortableModules) {\n this._enhancers.push(new PortableMinifierModuleIdsPlugin(this.hooks));\n }\n\n if (compressAsyncImports) {\n this._enhancers.push(new AsyncImportCompressionPlugin(this.hooks));\n }\n\n this.hooks.rehydrateAssets.tap(PLUGIN_NAME, defaultRehydrateAssets);\n this.minifier = minifier;\n\n this._sourceMap = sourceMap;\n }\n\n public static getCompilationStatistics(\n compilation: webpack.compilation.Compilation\n ): IModuleMinifierPluginStats | undefined {\n return compilationMetadataMap.get(compilation);\n }\n\n public apply(compiler: webpack.Compiler): void {\n for (const enhancer of this._enhancers) {\n enhancer.apply(compiler);\n }\n\n const {\n options: { devtool, mode }\n } = compiler;\n // The explicit setting is preferred due to accuracy, but try to guess based on devtool\n const useSourceMaps: boolean =\n typeof this._sourceMap === 'boolean'\n ? this._sourceMap\n : typeof devtool === 'string'\n ? devtool.endsWith('source-map')\n : mode === 'production' && devtool !== false;\n\n this._optionsForHash.sourceMap = useSourceMaps;\n const binaryConfig: Uint8Array = Buffer.from(JSON.stringify(this._optionsForHash), 'utf-8');\n\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: webpack.compilation.Compilation, compilationData: _IWebpackCompilationData) => {\n const { normalModuleFactory } = compilationData;\n\n function addCommentExtraction(parser: webpack.compilation.normalModuleFactory.Parser): void {\n parser.hooks.program.tap(PLUGIN_NAME, (program: unknown, comments: _IAcornComment[]) => {\n (parser as IExtendedParser).state.module.factoryMeta.comments = comments.filter(isLicenseComment);\n });\n }\n\n normalModuleFactory.hooks.parser.for('javascript/auto').tap(PLUGIN_NAME, addCommentExtraction);\n normalModuleFactory.hooks.parser.for('javascript/dynamic').tap(PLUGIN_NAME, addCommentExtraction);\n normalModuleFactory.hooks.parser.for('javascript/esm').tap(PLUGIN_NAME, addCommentExtraction);\n\n /**\n * Set of local module ids that have been processed.\n */\n const submittedModules: Set<string | number> = new Set();\n\n /**\n * The text and comments of all minified modules.\n */\n const minifiedModules: IModuleMap = new Map();\n\n /**\n * The text and comments of all minified chunks. Most of these are trivial, but the runtime chunk is a bit larger.\n */\n const minifiedAssets: IAssetMap = new Map();\n\n const metadataByAssetFileName: Map<string, IAssetStats> = new Map();\n const compilationStatistics: IModuleMinifierPluginStats = {\n metadataByAssetFileName\n };\n compilationMetadataMap.set(compilation, compilationStatistics);\n\n let pendingMinificationRequests: number = 0;\n /**\n * Indicates that all files have been sent to the minifier and therefore that when pending hits 0, assets can be rehydrated.\n */\n let allRequestsIssued: boolean = false;\n\n let resolveMinifyPromise: () => void;\n\n const getRealId: (id: number | string) => number | string | undefined = (id: number | string) =>\n this.hooks.finalModuleId.call(id, compilation);\n\n const postProcessCode: (\n code: ReplaceSource,\n context: IPostProcessFragmentContext\n ) => ReplaceSource = (code: ReplaceSource, context: IPostProcessFragmentContext) =>\n this.hooks.postProcessCodeFragment.call(code, context);\n\n /**\n * Callback to invoke when a file has finished minifying.\n */\n function onFileMinified(): void {\n if (--pendingMinificationRequests === 0 && allRequestsIssued) {\n resolveMinifyPromise();\n }\n }\n\n const { minifier } = this;\n\n let minifierConnection: IMinifierConnection | undefined;\n\n const requestShortener: webpack.compilation.RequestShortener =\n compilation.runtimeTemplate.requestShortener;\n\n /**\n * Extracts the code for the module and sends it to be minified.\n * Currently source maps are explicitly not supported.\n * @param {Source} source\n * @param {Module} mod\n */\n function minifyModule(source: Source, mod: IExtendedModule): Source {\n const id: string | number | null = mod.id;\n\n if (id !== null && !submittedModules.has(id)) {\n // options.chunk contains the current chunk, if needed\n // Render the source, then hash, then persist hash -> module, return a placeholder\n\n // Initially populate the map with unminified version; replace during callback\n submittedModules.add(id);\n\n const realId: string | number | undefined = getRealId(id);\n\n if (realId !== undefined && !mod.factoryMeta.skipMinification) {\n const wrapped: ConcatSource = new ConcatSource(\n MODULE_WRAPPER_PREFIX + '\\n',\n source,\n '\\n' + MODULE_WRAPPER_SUFFIX\n );\n\n const nameForMap: string = `(modules)/${realId}`;\n\n const { source: wrappedCode, map } = useSourceMaps\n ? wrapped.sourceAndMap()\n : {\n source: wrapped.source(),\n map: undefined\n };\n\n const hash: string = hashCodeFragment(wrappedCode);\n\n ++pendingMinificationRequests;\n\n minifier.minify(\n {\n hash,\n code: wrappedCode,\n nameForMap: useSourceMaps ? nameForMap : undefined,\n externals: undefined\n },\n (result: IModuleMinificationResult) => {\n if (isMinificationResultError(result)) {\n compilation.errors.push(result.error);\n } else {\n try {\n // Have the source map display the module id instead of the minifier boilerplate\n const sourceForMap: string = `// ${mod.readableIdentifier(\n requestShortener\n )}${wrappedCode.slice(MODULE_WRAPPER_PREFIX.length, -MODULE_WRAPPER_SUFFIX.length)}`;\n\n const { code: minified, map: minifierMap } = result;\n\n const rawOutput: Source = useSourceMaps\n ? new SourceMapSource(\n minified, // Code\n nameForMap, // File\n minifierMap!, // Base source map\n sourceForMap, // Source from before transform\n map!, // Source Map from before transform\n false // Remove original source\n )\n : new RawSource(minified);\n\n const unwrapped: ReplaceSource = new ReplaceSource(rawOutput);\n const len: number = minified.length;\n\n unwrapped.replace(0, MODULE_WRAPPER_PREFIX.length - 1, '');\n unwrapped.replace(len - MODULE_WRAPPER_SUFFIX.length, len - 1, '');\n\n const withIds: Source = postProcessCode(unwrapped, {\n compilation,\n module: mod,\n loggingName: mod.identifier()\n });\n const cached: CachedSource = new CachedSource(withIds);\n\n const minifiedSize: number = Buffer.byteLength(cached.source(), 'utf-8');\n mod.factoryMeta.minifiedSize = minifiedSize;\n\n minifiedModules.set(realId, {\n source: cached,\n module: mod\n });\n } catch (err) {\n compilation.errors.push(err);\n }\n }\n\n onFileMinified();\n }\n );\n } else {\n // Route any other modules straight through\n const cached: CachedSource = new CachedSource(\n postProcessCode(new ReplaceSource(source), {\n compilation,\n module: mod,\n loggingName: mod.identifier()\n })\n );\n\n const minifiedSize: number = Buffer.byteLength(cached.source(), 'utf-8');\n mod.factoryMeta.minifiedSize = minifiedSize;\n\n minifiedModules.set(realId !== undefined ? realId : id, {\n source: cached,\n module: mod\n });\n }\n }\n\n // Return something so that this stage still produces valid ECMAScript\n return new RawSource('(function(){})');\n }\n\n const jsTemplate: IExtendedModuleTemplate = compilation.moduleTemplates\n .javascript as IExtendedModuleTemplate;\n const innerRender: IExtendedModuleTemplate['render'] = jsTemplate.render.bind(jsTemplate);\n\n // The optimizeTree hook is the last async hook that occurs before chunk rendering\n compilation.hooks.optimizeTree.tapPromise(PLUGIN_NAME, async () => {\n minifierConnection = await minifier.connectAsync();\n\n submittedModules.clear();\n\n const cache: WeakSet<IExtendedModule> = new WeakSet();\n const defaultSource: Source = new RawSource('');\n\n // During code generation, send the generated code to the minifier and replace with a placeholder\n // Hacking this to avoid calling .source() on a concatenated module multiple times\n jsTemplate.render = (module: IExtendedModule, dependencyTemplates, options) => {\n if (!cache.has(module)) {\n cache.add(module);\n const rendered: Source = innerRender(module, dependencyTemplates, options);\n\n minifyModule(rendered, module);\n }\n\n return defaultSource;\n };\n });\n\n // This should happen before any other tasks that operate during optimizeChunkAssets\n compilation.hooks.optimizeChunkAssets.tapPromise(\n TAP_BEFORE,\n async (chunks: webpack.compilation.Chunk[]): Promise<void> => {\n // Still need to minify the rendered assets\n for (const chunk of chunks) {\n const externals: string[] = [];\n const externalNames: Map<string, string> = new Map();\n\n const chunkModuleSet: Set<string | number> = new Set();\n const allChunkModules: Iterable<IExtendedModule> =\n chunk.modulesIterable as Iterable<IExtendedModule>;\n let hasNonNumber: boolean = false;\n for (const mod of allChunkModules) {\n if (mod.id !== null) {\n if (typeof mod.id !== 'number') {\n hasNonNumber = true;\n }\n chunkModuleSet.add(mod.id);\n\n if (mod.external) {\n // Match the identifiers generated in the AmdMainTemplatePlugin\n // https://github.com/webpack/webpack/blob/444e59f8a427f94f0064cae6765e5a3c4b78596d/lib/AmdMainTemplatePlugin.js#L49\n const key: string = `__WEBPACK_EXTERNAL_MODULE_${webpack.Template.toIdentifier(\n `${mod.id}`\n )}__`;\n // The first two identifiers are used for function (module, exports) at the module site\n const ordinal: number = 2 + externals.length;\n const miniId: string = getIdentifier(ordinal);\n externals.push(key);\n externalNames.set(key, miniId);\n }\n }\n }\n\n const chunkModules: (string | number)[] = Array.from(chunkModuleSet);\n // Sort by id before rehydration in case we rehydrate a given chunk multiple times\n chunkModules.sort(\n hasNonNumber\n ? stringifyIdSortPredicate\n : (x: string | number, y: string | number) => (x as number) - (y as number)\n );\n\n for (const assetName of chunk.files) {\n const asset: Source = compilation.assets[assetName];\n\n // Verify that this is a JS asset\n if (/\\.m?js(\\?.+)?$/.test(assetName)) {\n ++pendingMinificationRequests;\n\n const rawCode: string = asset.source() as string;\n const nameForMap: string = `(chunks)/${assetName}`;\n\n const hash: string = hashCodeFragment(rawCode);\n\n minifier.minify(\n {\n hash,\n code: rawCode,\n nameForMap: useSourceMaps ? nameForMap : undefined,\n externals\n },\n (result: IModuleMinificationResult) => {\n if (isMinificationResultError(result)) {\n compilation.errors.push(result.error);\n // eslint-disable-next-line no-console\n console.error(result.error);\n } else {\n try {\n const { code: minified, map: minifierMap } = result;\n\n let codeForMap: string = rawCode;\n if (useSourceMaps) {\n // Pretend the __WEBPACK_CHUNK_MODULES__ token is an array of module ids, so that the source map contains information about the module ids in the chunk\n codeForMap = codeForMap.replace(\n CHUNK_MODULES_TOKEN,\n JSON.stringify(chunkModules, undefined, 2)\n );\n }\n\n const rawOutput: Source = useSourceMaps\n ? new SourceMapSource(\n minified, // Code\n nameForMap, // File\n minifierMap!, // Base source map\n codeForMap, // Source from before transform\n undefined, // Source Map from before transform\n false // Remove original source\n )\n : new RawSource(minified);\n\n const withIds: Source = postProcessCode(new ReplaceSource(rawOutput), {\n compilation,\n module: undefined,\n loggingName: assetName\n });\n\n minifiedAssets.set(assetName, {\n source: new CachedSource(withIds),\n modules: chunkModules,\n chunk,\n fileName: assetName,\n renderInfo: new Map(),\n externalNames\n });\n } catch (err) {\n compilation.errors.push(err);\n }\n }\n\n onFileMinified();\n }\n );\n } else {\n // This isn't a JS asset. Don't try to minify the asset wrapper, though if it contains modules, those might still get replaced with minified versions.\n minifiedAssets.set(assetName, {\n // Still need to restore ids\n source: postProcessCode(new ReplaceSource(asset), {\n compilation,\n module: undefined,\n loggingName: assetName\n }),\n modules: chunkModules,\n chunk,\n fileName: assetName,\n renderInfo: new Map(),\n externalNames\n });\n }\n }\n }\n\n allRequestsIssued = true;\n\n if (pendingMinificationRequests) {\n await new Promise<void>((resolve) => {\n resolveMinifyPromise = resolve;\n });\n }\n\n // Handle any error from the minifier.\n await minifierConnection?.disconnectAsync();\n\n // All assets and modules have been minified, hand them off to be rehydrated\n await this.hooks.rehydrateAssets.promise(\n {\n assets: minifiedAssets,\n modules: minifiedModules\n },\n compilation\n );\n }\n );\n\n function updateChunkHash(hash: Hash, chunk: webpack.compilation.Chunk): void {\n // Apply the options hash\n hash.update(binaryConfig);\n // Apply the hash from the minifier\n if (minifierConnection) {\n hash.update(minifierConnection.configHash, 'utf8');\n }\n }\n\n // Need to update chunk hashes with information from this plugin\n (compilation.chunkTemplate as unknown as IExtendedChunkTemplate).hooks.hashForChunk.tap(\n PLUGIN_NAME,\n updateChunkHash\n );\n compilation.mainTemplate.hooks.hashForChunk.tap(PLUGIN_NAME, updateChunkHash);\n\n // This function is written twice because the parameter order is not the same between the two hooks\n (compilation.chunkTemplate as unknown as IExtendedChunkTemplate).hooks.modules.tap(\n TAP_AFTER,\n (source: Source, chunk: webpack.compilation.Chunk, moduleTemplate: unknown) => {\n if (moduleTemplate !== compilation.moduleTemplates.javascript) {\n // This is not a JavaScript asset\n return source;\n }\n\n // Discard the rendered modules\n return new RawSource(CHUNK_MODULES_TOKEN);\n }\n );\n\n (compilation.mainTemplate as unknown as IExtendedChunkTemplate).hooks.modules.tap(\n TAP_AFTER,\n (source: Source, chunk: webpack.compilation.Chunk, hash: unknown, moduleTemplate: unknown) => {\n if (moduleTemplate !== compilation.moduleTemplates.javascript) {\n // This is not a JavaScript asset\n return source;\n }\n\n // Discard the rendered modules\n return new RawSource(CHUNK_MODULES_TOKEN);\n }\n );\n }\n );\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IModuleMinifier } from '@rushstack/module-minifier';
|
|
2
1
|
import type { AsyncSeriesWaterfallHook, SyncWaterfallHook } from 'tapable';
|
|
3
2
|
import type * as webpack from 'webpack';
|
|
4
3
|
import type { ReplaceSource, Source } from 'webpack-sources';
|
|
4
|
+
import type { IModuleMinifier } from '@rushstack/module-minifier';
|
|
5
5
|
/**
|
|
6
6
|
* Information about where the module was rendered in the emitted asset.
|
|
7
7
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleMinifierPlugin.types.d.ts","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ModuleMinifierPlugin.types.d.ts","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;GAGG;AACH,M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OAAO,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,UAAU,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC;IAC7C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,eAAe,EAAE,wBAAwB,CAAC,iBAAiB,EAAE,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9F;;OAEG;IACH,aAAa,EAAE,iBAAiB,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAE/F;;OAEG;IACH,uBAAuB,EAAE,iBAAiB,CAAC,aAAa,EAAE,2BAA2B,CAAC,CAAC;CACxF;AAED;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleMinifierPlugin.types.js","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.types.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 {
|
|
1
|
+
{"version":3,"file":"ModuleMinifierPlugin.types.js","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.types.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 { AsyncSeriesWaterfallHook, SyncWaterfallHook } from 'tapable';\nimport type * as webpack from 'webpack';\nimport type { ReplaceSource, Source } from 'webpack-sources';\n\nimport type { IModuleMinifier } from '@rushstack/module-minifier';\n\n/**\n * Information about where the module was rendered in the emitted asset.\n * @public\n */\nexport interface IRenderedModulePosition {\n /**\n * The offset from the start of tha asset to the start of the module, in characters.\n */\n charOffset: number;\n /**\n * The length of the rendered module, in characters.\n */\n charLength: number;\n}\n\n/**\n * Information about a dehydrated webpack ECMAScript asset\n * @public\n */\nexport interface IAssetInfo {\n /**\n * The (minified) boilerplate code for the asset. Will contain a token to be replaced by the minified modules.\n */\n source: Source;\n\n /**\n * The name of the asset, used to index into compilation.assets\n */\n fileName: string;\n\n /**\n * The ids of the modules that are part of the chunk corresponding to this asset\n */\n modules: (string | number)[];\n\n /**\n * Information about the offsets and character lengths for each rendered module in the final asset.\n */\n renderInfo: Map<string | number, IRenderedModulePosition>;\n\n /**\n * The raw chunk object from Webpack, in case information from it is necessary for reconstruction\n */\n chunk: webpack.compilation.Chunk;\n\n /**\n * The set of external names to postprocess\n */\n externalNames: Map<string, string>;\n}\n\n/**\n * Statistics from the plugin. Namely module sizes.\n * @public\n */\nexport interface IModuleMinifierPluginStats {\n metadataByAssetFileName: Map<string, IAssetStats>;\n}\n\n/**\n * Rendered positional data\n * @public\n */\nexport interface IAssetStats {\n positionByModuleId: Map<string | number, IRenderedModulePosition>;\n}\n\n/**\n * Information about a minified module\n * @public\n */\nexport interface IModuleInfo {\n /**\n * The (minified) code of this module. Will be a function expression.\n */\n source: Source;\n\n /**\n * The raw module object from Webpack, in case information from it is necessary for reconstruction\n */\n module: IExtendedModule;\n}\n\n/**\n * Extension of the webpack Module typings with members that are used by this Plugin\n * @public\n */\nexport interface IExtendedModule extends webpack.compilation.Module {\n /**\n * Is this module external?\n */\n external?: boolean;\n /**\n * Concatenated modules\n */\n modules?: IExtendedModule[];\n /**\n * Recursively scan the dependencies of a module\n */\n hasDependencies(callback: (dep: webpack.compilation.Dependency) => boolean | void): boolean;\n /**\n * Id for the module\n */\n // eslint-disable-next-line @rushstack/no-new-null\n id: string | number | null;\n /**\n * Gets a descriptive identifier for the module.\n */\n identifier(): string;\n /**\n * Gets a friendly identifier for the module.\n */\n readableIdentifier(requestShortener: unknown): string;\n /**\n * Path to the physical file this module represents\n */\n resource?: string;\n}\n\ndeclare module 'webpack' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace compilation {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n interface RuntimeTemplate {\n requestShortener: webpack.compilation.RequestShortener;\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n interface RequestShortener {}\n }\n}\n\n/**\n * This is the second parameter to the thisCompilation and compilation webpack.Compiler hooks.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface _IWebpackCompilationData {\n normalModuleFactory: webpack.compilation.NormalModuleFactory;\n}\n\n/**\n * This is the second parameter to the NormalModuleFactory `module` hook\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface _INormalModuleFactoryModuleData {\n resourceResolveData?: {\n /**\n * Contents of the description file (package.json) for the module\n */\n descriptionFileData?: {\n /**\n * The name of the package\n */\n name: string;\n };\n /**\n * Absolute path of the description file (package.json) for the module\n */\n descriptionFilePath?: string;\n /**\n * Absolute path of the directory containing the description file (package.json) for the module\n */\n descriptionFileRoot?: string;\n /**\n * Relative path from the description file (package.json) to the module\n */\n relativePath?: string;\n };\n}\n\n/**\n * A map from file names to dehydrated assets\n * @public\n */\nexport type IAssetMap = Map<string, IAssetInfo>;\n/**\n * A map from module ids to minified modules\n * @public\n */\nexport type IModuleMap = Map<string | number, IModuleInfo>;\n\n/**\n * Options to the ModuleMinifierPlugin constructor\n * @public\n */\nexport interface IModuleMinifierPluginOptions {\n /**\n * Minifier implementation to use. Required.\n */\n minifier: IModuleMinifier;\n\n /**\n * Whether to enable source map processing. If not provided, will attempt to guess based on `mode` and `devtool` in the webpack config.\n * Set to `false` for faster builds at the expense of debuggability.\n */\n sourceMap?: boolean;\n\n /**\n * Instructs the plugin to alter the code of modules to maximize portability across compilations.\n */\n usePortableModules?: boolean;\n\n /**\n * Instructs the plugin to alter the code of async import statements to compress better and be portable across compilations.\n */\n compressAsyncImports?: boolean;\n}\n\n/**\n * The set of data remaining to rehydrate in the current compilation\n * @public\n */\nexport interface IDehydratedAssets {\n /**\n * The set of remaining assets to rehydrate. Each tap may remove some or all assets from this collection\n */\n assets: IAssetMap;\n\n /**\n * The set of modules to use for rehydrating assets.\n */\n modules: IModuleMap;\n}\n\n/**\n * Argument to the postProcessCodeFragment hook for the current execution context\n * @public\n */\nexport interface IPostProcessFragmentContext {\n /**\n * The current webpack compilation, for error reporting\n */\n compilation: webpack.compilation.Compilation;\n /**\n * A name to use for logging\n */\n loggingName: string;\n /**\n * The current module being processed, or `undefined` if not in a module (e.g. the bootstrapper)\n */\n module: webpack.compilation.Module | undefined;\n}\n\n/**\n * Hooks provided by the ModuleMinifierPlugin\n * @public\n */\nexport interface IModuleMinifierPluginHooks {\n /**\n * Hook invoked at the start of optimizeChunkAssets to rehydrate the minified boilerplate and runtime into chunk assets.\n */\n rehydrateAssets: AsyncSeriesWaterfallHook<IDehydratedAssets, webpack.compilation.Compilation>;\n\n /**\n * Hook invoked on a module id to get the final rendered id.\n */\n finalModuleId: SyncWaterfallHook<string | number | undefined, webpack.compilation.Compilation>;\n\n /**\n * Hook invoked on code after it has been returned from the minifier.\n */\n postProcessCodeFragment: SyncWaterfallHook<ReplaceSource, IPostProcessFragmentContext>;\n}\n\n/**\n * The comment objects from the Acorn parser inside of webpack\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface _IAcornComment {\n type: 'Line' | 'Block';\n value: string;\n start: number;\n end: number;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverrideWebpackIdentifierAllocation.js","sourceRoot":"","sources":["../src/OverrideWebpackIdentifierAllocation.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,qCAAmC;
|
|
1
|
+
{"version":3,"file":"OverrideWebpackIdentifierAllocation.js","sourceRoot":"","sources":["../src/OverrideWebpackIdentifierAllocation.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,qCAAmC;AAEnC,gEAA2D;AAE3D,2GAA2G;AAC3G,kBAAQ,CAAC,iBAAiB,GAAG,+BAAa,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 { Template } from 'webpack';\n\nimport { getIdentifier } from '@rushstack/module-minifier';\n\n// Configure webpack to use the same identifier allocation logic as Terser to maximize gzip compressibility\nTemplate.numberToIdentifer = getIdentifier;\n"]}
|
package/lib/ParallelCompiler.js
CHANGED
|
@@ -6,8 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.runParallel = runParallel;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
11
|
const module_minifier_1 = require("@rushstack/module-minifier");
|
|
12
12
|
const worker_pool_1 = require("@rushstack/worker-pool");
|
|
13
13
|
const ZERO = BigInt(0);
|
|
@@ -38,11 +38,11 @@ function formatTime(timeNs) {
|
|
|
38
38
|
}
|
|
39
39
|
async function runParallel(options) {
|
|
40
40
|
var _a, _b;
|
|
41
|
-
const resolvedPath = (0,
|
|
41
|
+
const resolvedPath = (0, node_path_1.resolve)(options.configFilePath);
|
|
42
42
|
const rawConfig = require(resolvedPath);
|
|
43
43
|
const configArray = Array.isArray(rawConfig) ? rawConfig : [rawConfig];
|
|
44
44
|
const configCount = configArray.length;
|
|
45
|
-
const totalCpus = (_b = (_a =
|
|
45
|
+
const totalCpus = (_b = (_a = node_os_1.default.availableParallelism) === null || _a === void 0 ? void 0 : _a.call(node_os_1.default)) !== null && _b !== void 0 ? _b : node_os_1.default.cpus().length;
|
|
46
46
|
// TODO: Use all cores if not minifying
|
|
47
47
|
const { maxCompilationThreads: maxConfiguredCompilationThreads = Math.max(totalCpus > 8 ? (totalCpus * 3) >> 2 : totalCpus >> 1, 1), sourceMap, usePortableModules } = options;
|
|
48
48
|
const maxCompilationThreads = Math.min(configCount, maxConfiguredCompilationThreads);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParallelCompiler.js","sourceRoot":"","sources":["../src/ParallelCompiler.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAuD3D,kCAqFC;AA1ID,
|
|
1
|
+
{"version":3,"file":"ParallelCompiler.js","sourceRoot":"","sources":["../src/ParallelCompiler.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAuD3D,kCAqFC;AA1ID,sDAAyB;AACzB,yCAAoC;AAWpC,gEAAgE;AAChE,wDAAoD;AAWpD,MAAM,IAAI,GAAW,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/B,MAAM,QAAQ,GAAW,MAAM,CAAC,GAAG,CAAC,CAAC;AAErC;;;GAGG;AACH,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,IAAI,GAAW,IAAI,CAAC;IACxB,IAAI,QAAQ,GAAW,IAAI,CAAC;IAC5B,IAAI,MAAM,GAAG,QAAQ,EAAE,CAAC;QACtB,IAAI,GAAG,IAAI,CAAC;QACZ,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;QAC7B,MAAM,IAAI,QAAQ,CAAC;IACrB,CAAC;IACD,IAAI,MAAM,GAAG,QAAQ,EAAE,CAA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OAAO,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;YACtD,CAAC;YAED,EAAE,SAAS,CAAC;YACZ,sCAAsC;YACtC,OAAO,CAAC,GAAG,CACT,GAAG,SAAS,IAAI,WAAW,cAAc,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAC5F,CAAC;YAEF,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;YAC9C,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAC3C,CAAC,CAAC;QAEF,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAC7C,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,WAAW,CAAC,WAAW,EAAE,CAAC;IAEhC,MAAM,kBAAkB,CAAC,eAAe,EAAE,CAAC;AAC7C,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 os from 'node:os';\nimport { resolve } from 'node:path';\nimport type { Worker } from 'node:worker_threads';\n\nimport type { Configuration } from 'webpack';\n\nimport type {\n IMinifierConnection,\n IModuleMinificationRequest,\n IModuleMinificationResult,\n MinifyOptions\n} from '@rushstack/module-minifier';\nimport { WorkerPoolMinifier } from '@rushstack/module-minifier';\nimport { WorkerPool } from '@rushstack/worker-pool';\n\nexport interface IParallelWebpackOptions {\n cacheDirectory?: string;\n configFilePath: string;\n maxCompilationThreads?: number;\n sourceMap?: boolean | undefined;\n terserOptions?: MinifyOptions;\n usePortableModules?: boolean;\n}\n\nconst ZERO: bigint = BigInt(0);\nconst THOUSAND: bigint = BigInt(1e3);\n\n/**\n * Formats a delta of `process.hrtime.bigint()` values as a string\n * @param timeNs\n */\nfunction formatTime(timeNs: bigint): string {\n let unit: string = 'ns';\n let fraction: bigint = ZERO;\n if (timeNs > THOUSAND) {\n unit = 'us';\n fraction = timeNs % THOUSAND;\n timeNs /= THOUSAND;\n }\n if (timeNs > THOUSAND) {\n unit = 'ms';\n fraction = timeNs % THOUSAND;\n timeNs /= THOUSAND;\n }\n if (timeNs > THOUSAND) {\n unit = 's';\n fraction = timeNs % THOUSAND;\n timeNs /= THOUSAND;\n }\n\n return `${timeNs}.${('000' + fraction).slice(-3, -1)} ${unit}`;\n}\n\nexport async function runParallel(options: IParallelWebpackOptions): Promise<void> {\n const resolvedPath: string = resolve(options.configFilePath);\n const rawConfig: Configuration | Configuration[] = require(resolvedPath);\n const configArray: Configuration[] = Array.isArray(rawConfig) ? rawConfig : [rawConfig];\n const configCount: number = configArray.length;\n\n const totalCpus: number = os.availableParallelism?.() ?? os.cpus().length;\n\n // TODO: Use all cores if not minifying\n const {\n maxCompilationThreads: maxConfiguredCompilationThreads = Math.max(\n totalCpus > 8 ? (totalCpus * 3) >> 2 : totalCpus >> 1,\n 1\n ),\n sourceMap,\n usePortableModules\n } = options;\n\n const maxCompilationThreads: number = Math.min(configCount, maxConfiguredCompilationThreads);\n\n const maxCompressionThreads: number = Math.max(1, totalCpus - maxCompilationThreads);\n\n const minifier: WorkerPoolMinifier = new WorkerPoolMinifier({\n terserOptions: options.terserOptions,\n maxThreads: maxCompressionThreads\n });\n\n const minifierConnection: IMinifierConnection = await minifier.connectAsync();\n\n const webpackPool: WorkerPool = new WorkerPool({\n id: 'Webpack',\n maxWorkers: maxCompilationThreads,\n onWorkerDestroyed: (): void => {\n // Allocate the webpack worker to terser\n minifier.maxThreads++;\n },\n workerScriptPath: require.resolve('./workerPool/WebpackWorker'),\n workerData: {\n configFilePath: resolvedPath,\n sourceMap,\n usePortableModules\n }\n });\n\n let processed: number = 0;\n const startTime: bigint = process.hrtime.bigint();\n\n for (let i: number = 0; i < configCount; i++) {\n const webpackWorker: Worker = await webpackPool.checkoutWorkerAsync(true);\n\n const sendMinifierResult: (result: IModuleMinificationResult) => void = (\n result: IModuleMinificationResult\n ): void => {\n webpackWorker.postMessage(result);\n };\n\n const workerOnMessage: (message: IModuleMinificationRequest | number) => void = (\n message: IModuleMinificationRequest | string | number\n ): void => {\n if (message === 'getConfigHash') {\n webpackWorker.postMessage(minifierConnection.configHash);\n return;\n }\n\n if (typeof message === 'object') {\n return minifier.minify(message, sendMinifierResult);\n }\n\n ++processed;\n // eslint-disable-next-line no-console\n console.log(\n `${processed}/${configCount} complete (${formatTime(process.hrtime.bigint() - startTime)})`\n );\n\n webpackWorker.off('message', workerOnMessage);\n webpackPool.checkinWorker(webpackWorker);\n };\n\n webpackWorker.on('message', workerOnMessage);\n webpackWorker.postMessage(i);\n }\n\n await webpackPool.finishAsync();\n\n await minifierConnection.disconnectAsync();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortableMinifierIdsPlugin.d.ts","sourceRoot":"","sources":["../src/PortableMinifierIdsPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PortableMinifierIdsPlugin.d.ts","sourceRoot":"","sources":["../src/PortableMinifierIdsPlugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAOhD,OAAO,KAAK,EAGV,0BAA0B,EAG3B,MAAM,8BAA8B,CAAC;AAkBtC;;;;GAIG;AACH,qBAAa,+BAAgC,YAAW,MAAM;IAC5D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;gBAEzC,aAAa,EAAE,0BAA0B;IAIrD,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CA6IvC"}
|
|
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.PortableMinifierModuleIdsPlugin = void 0;
|
|
9
|
-
const
|
|
9
|
+
const node_crypto_1 = require("node:crypto");
|
|
10
10
|
const RequestShortener_1 = __importDefault(require("webpack/lib/RequestShortener"));
|
|
11
11
|
const Constants_1 = require("./Constants");
|
|
12
12
|
const PLUGIN_NAME = 'PortableMinifierModuleIdsPlugin';
|
|
@@ -99,7 +99,7 @@ class PortableMinifierModuleIdsPlugin {
|
|
|
99
99
|
const originalId = mod.id;
|
|
100
100
|
// Need different cache keys for different sets of loaders, so can't use 'resource'
|
|
101
101
|
const identity = mod.identifier();
|
|
102
|
-
const hashId = (0,
|
|
102
|
+
const hashId = (0, node_crypto_1.createHash)('sha256').update(identity).digest('hex');
|
|
103
103
|
// This is designed to be an easily regex-findable string
|
|
104
104
|
const stableId = `${STABLE_MODULE_ID_PREFIX}${hashId}`;
|
|
105
105
|
const existingResource = resourceById.get(stableId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortableMinifierIdsPlugin.js","sourceRoot":"","sources":["../src/PortableMinifierIdsPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAK3D,mCAAoC;AAEpC,oFAA4D;AAE5D,2CAAwD;AASxD,MAAM,WAAW,GAAsC,iCAAiC,CAAC;AAEzF,MAAM,UAAU,GAAuB;IACrC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,wBAAY;CACpB,CAAC;AAEF,MAAM,SAAS,GAAuB;IACpC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,uBAAW;CACnB,CAAC;AAEF,MAAM,uBAAuB,GAAsB,iBAAiB,CAAC;AACrE,qGAAqG;AACrG,MAAM,sBAAsB,GAAW,6CAA6C,CAAC;AAErF;;;;GAIG;AACH,MAAa,+BAA+B;IAG1C,YAAmB,aAAyC;QAC1D,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,QAAkB;QAC7B,qFAAqF;QACrF,MAAM,WAAW,GAAgC,0BAAgB,CAAC,SAAS,CAAC,OA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E,CAAC;wBACrB,WAAW,CAAC,MAAM,CAAC,IAAI,CACrB,IAAI,KAAK,CACP,2BAA2B,QAAQ,SAAS,gBAAgB,uEAAuE,CACpI,CACF,CAAC;oBACJ,CAAC;oBAED,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;oBAE5C,8BAA8B;oBAC9B,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBACrC,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,oFAAoF;YACpF,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE;gBAC3D,uDAAuD;gBACvD,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;oBACtC,MAAM,QAAQ,GAAoB,GAAG,CAAC,EAAE,CAAC;oBACzC,MAAM,OAAO,GAAgC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAC7E,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;wBAC1B,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;oBACnB,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AApJD,0EAoJC","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 { Compiler, Plugin } from 'webpack';\nimport type webpack from 'webpack';\nimport type { ReplaceSource } from 'webpack-sources';\nimport { createHash } from 'crypto';\nimport type { TapOptions } from 'tapable';\nimport RequestShortener from 'webpack/lib/RequestShortener';\n\nimport { STAGE_AFTER, STAGE_BEFORE } from './Constants';\nimport type {\n _INormalModuleFactoryModuleData,\n IExtendedModule,\n IModuleMinifierPluginHooks,\n _IWebpackCompilationData,\n IPostProcessFragmentContext\n} from './ModuleMinifierPlugin.types';\n\nconst PLUGIN_NAME: 'PortableMinifierModuleIdsPlugin' = 'PortableMinifierModuleIdsPlugin';\n\nconst TAP_BEFORE: TapOptions<'sync'> = {\n name: PLUGIN_NAME,\n stage: STAGE_BEFORE\n};\n\nconst TAP_AFTER: TapOptions<'sync'> = {\n name: PLUGIN_NAME,\n stage: STAGE_AFTER\n};\n\nconst STABLE_MODULE_ID_PREFIX: '__MODULEID_SHA_' = '__MODULEID_SHA_';\n// The negative lookback here is to ensure that this regex does not match an async import placeholder\nconst STABLE_MODULE_ID_REGEX: RegExp = /(?<!C)['\"]?(__MODULEID_SHA_[0-9a-f]+)['\"]?/g;\n\n/**\n * Plugin responsible for converting the Webpack module ids (of whatever variety) to stable ids before code is handed to the minifier, then back again.\n * Uses the node module identity of the target module. Will emit an error if it encounters multiple versions of the same package in the same compilation.\n * @public\n */\nexport class PortableMinifierModuleIdsPlugin implements Plugin {\n private readonly _minifierHooks: IModuleMinifierPluginHooks;\n\n public constructor(minifierHooks: IModuleMinifierPluginHooks) {\n this._minifierHooks = minifierHooks;\n }\n\n public apply(compiler: Compiler): void {\n // Ensure that \"EXTERNAL MODULE: \" comments are portable and module version invariant\n const baseShorten: (request: string) => string = RequestShortener.prototype.shorten;\n RequestShortener.prototype.shorten = function (this: RequestShortener, request: string): string {\n const baseResult: string = baseShorten.call(this, request);\n const nodeModules: '/node_modules/' = '/node_modules/';\n\n if (!baseResult) {\n return baseResult;\n }\n\n const nodeModulesIndex: number = baseResult.lastIndexOf(nodeModules);\n if (nodeModulesIndex < 0) {\n return baseResult;\n }\n\n const nodeModulePath: string = baseResult.slice(nodeModulesIndex + nodeModules.length);\n this.cache.set(request, nodeModulePath);\n return nodeModulePath;\n };\n\n const stableIdToFinalId: Map<string | number, string | number> = new Map();\n\n this._minifierHooks.finalModuleId.tap(PLUGIN_NAME, (id: string | number | undefined) => {\n return id === undefined ? id : stableIdToFinalId.get(id);\n });\n\n this._minifierHooks.postProcessCodeFragment.tap(\n PLUGIN_NAME,\n (source: ReplaceSource, context: IPostProcessFragmentContext) => {\n const code: string = source.original().source() as string;\n\n STABLE_MODULE_ID_REGEX.lastIndex = -1;\n // RegExp.exec uses null or an array as the return type, explicitly\n let match: RegExpExecArray | null = null;\n while ((match = STABLE_MODULE_ID_REGEX.exec(code))) {\n const id: string = match[1];\n const mapped: string | number | undefined = this._minifierHooks.finalModuleId.call(\n id,\n context.compilation\n );\n\n if (mapped === undefined) {\n context.compilation.errors.push(\n new Error(`Missing module id for ${id} in ${context.loggingName}!`)\n );\n }\n\n source.replace(match.index, STABLE_MODULE_ID_REGEX.lastIndex - 1, JSON.stringify(mapped));\n }\n\n return source;\n }\n );\n\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: webpack.compilation.Compilation, compilationData: _IWebpackCompilationData) => {\n const { normalModuleFactory } = compilationData;\n\n normalModuleFactory.hooks.module.tap(\n PLUGIN_NAME,\n (mod: IExtendedModule, data: _INormalModuleFactoryModuleData) => {\n const { resourceResolveData: resolveData } = data;\n\n if (resolveData) {\n mod.factoryMeta.resolveData = resolveData;\n return;\n }\n\n // eslint-disable-next-line no-console\n console.error(`Missing resolution data for ${mod.resource}`);\n }\n );\n\n compilation.hooks.succeedModule.tap(PLUGIN_NAME, (mod: webpack.compilation.Module) => {\n const { resolveData } = mod.factoryMeta;\n\n if (!resolveData) {\n return;\n }\n\n const { descriptionFileData: packageJson, relativePath } = resolveData;\n\n if (packageJson && relativePath) {\n const nodeId: string = `${packageJson.name}${relativePath.slice(1).replace(/\\.js(on)?$/, '')}`;\n mod.factoryMeta.nodeResource = nodeId;\n }\n });\n\n stableIdToFinalId.clear();\n\n // Make module ids a pure function of the file path immediately before rendering.\n // Unfortunately, other means of altering these ids don't work in Webpack 4 without a lot more code and work.\n // Namely, a number of functions reference \"module.id\" directly during code generation\n\n compilation.hooks.beforeChunkAssets.tap(TAP_AFTER, () => {\n // For tracking collisions\n const resourceById: Map<string | number, string> = new Map();\n\n for (const mod of compilation.modules) {\n const originalId: string | number = mod.id;\n\n // Need different cache keys for different sets of loaders, so can't use 'resource'\n const identity: string = mod.identifier();\n const hashId: string = createHash('sha256').update(identity).digest('hex');\n\n // This is designed to be an easily regex-findable string\n const stableId: string = `${STABLE_MODULE_ID_PREFIX}${hashId}`;\n const existingResource: string | undefined = resourceById.get(stableId);\n\n if (existingResource) {\n compilation.errors.push(\n new Error(\n `Module id collision for ${identity} with ${existingResource}.\\n This means you are bundling multiple versions of the same module.`\n )\n );\n }\n\n stableIdToFinalId.set(stableId, originalId);\n\n // Record to detect collisions\n resourceById.set(stableId, identity);\n mod.id = stableId;\n }\n });\n\n // This is the hook immediately following chunk asset rendering. Fix the module ids.\n compilation.hooks.additionalChunkAssets.tap(TAP_BEFORE, () => {\n // Restore module ids in case any later hooks need them\n for (const mod of compilation.modules) {\n const stableId: string | number = mod.id;\n const finalId: string | number | undefined = stableIdToFinalId.get(stableId);\n if (finalId !== undefined) {\n mod.id = finalId;\n }\n }\n });\n }\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PortableMinifierIdsPlugin.js","sourceRoot":"","sources":["../src/PortableMinifierIdsPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,6CAAyC;AAMzC,oFAA4D;AAE5D,2CAAwD;AASxD,MAAM,WAAW,GAAsC,iCAAiC,CAAC;AAEzF,MAAM,UAAU,GAAuB;IACrC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,wBAAY;CACpB,CAAC;AAEF,MAAM,SAAS,GAAuB;IACpC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,uBAAW;CACnB,CAAC;AAEF,MAAM,uBAAuB,GAAsB,iBAAiB,CAAC;AACrE,qGAAqG;AACrG,MAAM,sBAAsB,GAAW,6CAA6C,CAAC;AAErF;;;;GAIG;AACH,MAAa,+BAA+B;IAG1C,YAAmB,aAAyC;QAC1D,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACt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AAC;oBAC/D,MAAM,gBAAgB,GAAuB,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAExE,IAAI,gBAAgB,EAAE,CAAC;wBACrB,WAAW,CAAC,MAAM,CAAC,IAAI,CACrB,IAAI,KAAK,CACP,2BAA2B,QAAQ,SAAS,gBAAgB,uEAAuE,CACpI,CACF,CAAC;oBACJ,CAAC;oBAED,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;oBAE5C,8BAA8B;oBAC9B,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBACrC,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,oFAAoF;YACpF,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE;gBAC3D,uDAAuD;gBACvD,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;oBACtC,MAAM,QAAQ,GAAoB,GAAG,CAAC,EAAE,CAAC;oBACzC,MAAM,OAAO,GAAgC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAC7E,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;wBAC1B,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;oBACnB,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AApJD,0EAoJC","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 { createHash } from 'node:crypto';\n\nimport type { Compiler, Plugin } from 'webpack';\nimport type webpack from 'webpack';\nimport type { ReplaceSource } from 'webpack-sources';\nimport type { TapOptions } from 'tapable';\nimport RequestShortener from 'webpack/lib/RequestShortener';\n\nimport { STAGE_AFTER, STAGE_BEFORE } from './Constants';\nimport type {\n _INormalModuleFactoryModuleData,\n IExtendedModule,\n IModuleMinifierPluginHooks,\n _IWebpackCompilationData,\n IPostProcessFragmentContext\n} from './ModuleMinifierPlugin.types';\n\nconst PLUGIN_NAME: 'PortableMinifierModuleIdsPlugin' = 'PortableMinifierModuleIdsPlugin';\n\nconst TAP_BEFORE: TapOptions<'sync'> = {\n name: PLUGIN_NAME,\n stage: STAGE_BEFORE\n};\n\nconst TAP_AFTER: TapOptions<'sync'> = {\n name: PLUGIN_NAME,\n stage: STAGE_AFTER\n};\n\nconst STABLE_MODULE_ID_PREFIX: '__MODULEID_SHA_' = '__MODULEID_SHA_';\n// The negative lookback here is to ensure that this regex does not match an async import placeholder\nconst STABLE_MODULE_ID_REGEX: RegExp = /(?<!C)['\"]?(__MODULEID_SHA_[0-9a-f]+)['\"]?/g;\n\n/**\n * Plugin responsible for converting the Webpack module ids (of whatever variety) to stable ids before code is handed to the minifier, then back again.\n * Uses the node module identity of the target module. Will emit an error if it encounters multiple versions of the same package in the same compilation.\n * @public\n */\nexport class PortableMinifierModuleIdsPlugin implements Plugin {\n private readonly _minifierHooks: IModuleMinifierPluginHooks;\n\n public constructor(minifierHooks: IModuleMinifierPluginHooks) {\n this._minifierHooks = minifierHooks;\n }\n\n public apply(compiler: Compiler): void {\n // Ensure that \"EXTERNAL MODULE: \" comments are portable and module version invariant\n const baseShorten: (request: string) => string = RequestShortener.prototype.shorten;\n RequestShortener.prototype.shorten = function (this: RequestShortener, request: string): string {\n const baseResult: string = baseShorten.call(this, request);\n const nodeModules: '/node_modules/' = '/node_modules/';\n\n if (!baseResult) {\n return baseResult;\n }\n\n const nodeModulesIndex: number = baseResult.lastIndexOf(nodeModules);\n if (nodeModulesIndex < 0) {\n return baseResult;\n }\n\n const nodeModulePath: string = baseResult.slice(nodeModulesIndex + nodeModules.length);\n this.cache.set(request, nodeModulePath);\n return nodeModulePath;\n };\n\n const stableIdToFinalId: Map<string | number, string | number> = new Map();\n\n this._minifierHooks.finalModuleId.tap(PLUGIN_NAME, (id: string | number | undefined) => {\n return id === undefined ? id : stableIdToFinalId.get(id);\n });\n\n this._minifierHooks.postProcessCodeFragment.tap(\n PLUGIN_NAME,\n (source: ReplaceSource, context: IPostProcessFragmentContext) => {\n const code: string = source.original().source() as string;\n\n STABLE_MODULE_ID_REGEX.lastIndex = -1;\n // RegExp.exec uses null or an array as the return type, explicitly\n let match: RegExpExecArray | null = null;\n while ((match = STABLE_MODULE_ID_REGEX.exec(code))) {\n const id: string = match[1];\n const mapped: string | number | undefined = this._minifierHooks.finalModuleId.call(\n id,\n context.compilation\n );\n\n if (mapped === undefined) {\n context.compilation.errors.push(\n new Error(`Missing module id for ${id} in ${context.loggingName}!`)\n );\n }\n\n source.replace(match.index, STABLE_MODULE_ID_REGEX.lastIndex - 1, JSON.stringify(mapped));\n }\n\n return source;\n }\n );\n\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: webpack.compilation.Compilation, compilationData: _IWebpackCompilationData) => {\n const { normalModuleFactory } = compilationData;\n\n normalModuleFactory.hooks.module.tap(\n PLUGIN_NAME,\n (mod: IExtendedModule, data: _INormalModuleFactoryModuleData) => {\n const { resourceResolveData: resolveData } = data;\n\n if (resolveData) {\n mod.factoryMeta.resolveData = resolveData;\n return;\n }\n\n // eslint-disable-next-line no-console\n console.error(`Missing resolution data for ${mod.resource}`);\n }\n );\n\n compilation.hooks.succeedModule.tap(PLUGIN_NAME, (mod: webpack.compilation.Module) => {\n const { resolveData } = mod.factoryMeta;\n\n if (!resolveData) {\n return;\n }\n\n const { descriptionFileData: packageJson, relativePath } = resolveData;\n\n if (packageJson && relativePath) {\n const nodeId: string = `${packageJson.name}${relativePath.slice(1).replace(/\\.js(on)?$/, '')}`;\n mod.factoryMeta.nodeResource = nodeId;\n }\n });\n\n stableIdToFinalId.clear();\n\n // Make module ids a pure function of the file path immediately before rendering.\n // Unfortunately, other means of altering these ids don't work in Webpack 4 without a lot more code and work.\n // Namely, a number of functions reference \"module.id\" directly during code generation\n\n compilation.hooks.beforeChunkAssets.tap(TAP_AFTER, () => {\n // For tracking collisions\n const resourceById: Map<string | number, string> = new Map();\n\n for (const mod of compilation.modules) {\n const originalId: string | number = mod.id;\n\n // Need different cache keys for different sets of loaders, so can't use 'resource'\n const identity: string = mod.identifier();\n const hashId: string = createHash('sha256').update(identity).digest('hex');\n\n // This is designed to be an easily regex-findable string\n const stableId: string = `${STABLE_MODULE_ID_PREFIX}${hashId}`;\n const existingResource: string | undefined = resourceById.get(stableId);\n\n if (existingResource) {\n compilation.errors.push(\n new Error(\n `Module id collision for ${identity} with ${existingResource}.\\n This means you are bundling multiple versions of the same module.`\n )\n );\n }\n\n stableIdToFinalId.set(stableId, originalId);\n\n // Record to detect collisions\n resourceById.set(stableId, identity);\n mod.id = stableId;\n }\n });\n\n // This is the hook immediately following chunk asset rendering. Fix the module ids.\n compilation.hooks.additionalChunkAssets.tap(TAP_BEFORE, () => {\n // Restore module ids in case any later hooks need them\n for (const mod of compilation.modules) {\n const stableId: string | number = mod.id;\n const finalId: string | number | undefined = stableIdToFinalId.get(stableId);\n if (finalId !== undefined) {\n mod.id = finalId;\n }\n }\n });\n }\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpackWorker.d.ts","sourceRoot":"","sources":["../../src/workerPool/WebpackWorker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebpackWorker.d.ts","sourceRoot":"","sources":["../../src/workerPool/WebpackWorker.ts"],"names":[],"mappings":"AAUA,OAAO,wCAAwC,CAAC"}
|
|
@@ -35,8 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
};
|
|
36
36
|
})();
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const workerThreads = __importStar(require("node:worker_threads"));
|
|
38
39
|
const webpack = require("webpack");
|
|
39
|
-
const workerThreads = __importStar(require("worker_threads"));
|
|
40
40
|
const module_minifier_1 = require("@rushstack/module-minifier");
|
|
41
41
|
const ModuleMinifierPlugin_1 = require("../ModuleMinifierPlugin");
|
|
42
42
|
require("../OverrideWebpackIdentifierAllocation");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpackWorker.js","sourceRoot":"","sources":["../../src/workerPool/WebpackWorker.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,
|
|
1
|
+
{"version":3,"file":"WebpackWorker.js","sourceRoot":"","sources":["../../src/workerPool/WebpackWorker.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,mEAAqD;AAErD,mCAAoC;AAEpC,gEAAiE;AAEjE,kEAA+D;AAC/D,kDAAgD;AAEhD,oCAAoC;AACpC,OAAO,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;AAExB,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,aAAa,CAAC,UAAU,CAAC;AAEnF,MAAM,cAAc,GAA4B,OAAO,CAAC,cAAc,CAAC,CAAC;AAExE,+BAA+B;AAE/B,MAAM,QAAQ,GAAwB,IAAI,qCAAmB,CAAC,aAAa,CAAC,UAAW,CAAC,CAAC;AAEzF,KAAK,UAAU,gBAAgB,CAAC,KAAa;IAC3C,MAAM,MAAM,GAA0B,cAAc,CAAC,KAAK,CAAC,CAAC;IAC5D,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE7F,MAAM,YAAY,GAAiC,MAAM,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;IACrG,MAAM,EAAE,S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ClC,sCAAsC;oBACtC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC,CAAC,CAAC;gBAEH,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAuB,UAAU,CAAC,MAAM,CAAC,MAAM,YAAY,CAAC,CAAC,CAAC;YACxF,CAAC;YAED,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAErB,aAAa,CAAC,UAAW,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAgC,EAAE,EAAE;IAC3E,sBAAsB;IACtB,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,oCAAoC;IACpC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAW,OAAiB,CAAC;IAExC,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CAC1B,GAAG,EAAE;QACH,aAAa,CAAC,UAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,EACD,CAAC,GAAU,EAAE,EAAE;QACb,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,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 workerThreads from 'node:worker_threads';\n\nimport webpack = require('webpack');\n\nimport { MessagePortMinifier } from '@rushstack/module-minifier';\n\nimport { ModuleMinifierPlugin } from '../ModuleMinifierPlugin';\nimport '../OverrideWebpackIdentifierAllocation';\n\n// Hack to support mkdirp on node 10\nprocess.umask = () => 0;\n\nconst { configFilePath, sourceMap, usePortableModules } = workerThreads.workerData;\n\nconst webpackConfigs: webpack.Configuration[] = require(configFilePath);\n\n// chalk.enabled = enableColor;\n\nconst minifier: MessagePortMinifier = new MessagePortMinifier(workerThreads.parentPort!);\n\nasync function processTaskAsync(index: number): Promise<void> {\n const config: webpack.Configuration = webpackConfigs[index];\n // eslint-disable-next-line no-console\n console.log(`Compiling config: ${config.name || (config.output && config.output.filename)}`);\n\n const optimization: webpack.Options.Optimization = config.optimization || (config.optimization = {});\n const { minimizer } = optimization;\n\n if (minimizer) {\n for (const plugin of minimizer) {\n if (plugin instanceof ModuleMinifierPlugin) {\n plugin.minifier = minifier;\n }\n }\n } else {\n const { devtool, mode } = config;\n\n const finalSourceMap: boolean =\n typeof sourceMap === 'boolean'\n ? sourceMap\n : typeof devtool === 'string'\n ? devtool.endsWith('source-map') && !devtool.includes('eval')\n : devtool !== false && mode === 'production';\n\n optimization.minimizer = [\n new ModuleMinifierPlugin({\n minifier,\n usePortableModules,\n sourceMap: finalSourceMap\n })\n ];\n }\n\n await new Promise<void>((resolve: () => void, reject: (err: Error) => void) => {\n const compiler: webpack.Compiler = webpack(config);\n compiler.run(async (err: Error | undefined, stats: webpack.Stats) => {\n if (err) {\n return reject(err);\n }\n\n if (stats && stats.hasErrors()) {\n const errorStats: webpack.Stats.ToJsonOutput = stats.toJson('errors-only');\n\n errorStats.errors.forEach((error) => {\n // eslint-disable-next-line no-console\n console.error(error);\n });\n\n return reject(new Error(`Webpack failed with ${errorStats.errors.length} error(s).`));\n }\n\n resolve();\n });\n });\n}\n\nprocess.exitCode = 3;\n\nworkerThreads.parentPort!.on('message', (message: number | false | object) => {\n // Termination request\n if (message === false) {\n process.exit(0);\n }\n\n // Input for the MessagePortMinifier\n if (typeof message === 'object') {\n return;\n }\n\n const index: number = message as number;\n\n processTaskAsync(index).then(\n () => {\n workerThreads.parentPort!.postMessage(index);\n },\n (err: Error) => {\n // eslint-disable-next-line no-console\n console.error(err);\n process.exit(1);\n }\n );\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/webpack4-module-minifier-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "This plugin splits minification of webpack compilations into smaller units.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "dist/webpack4-module-minifier-plugin.d.ts",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@types/tapable": "1.0.6",
|
|
36
36
|
"tapable": "1.1.3",
|
|
37
|
-
"@rushstack/worker-pool": "0.
|
|
38
|
-
"@rushstack/module-minifier": "0.
|
|
37
|
+
"@rushstack/worker-pool": "0.6.0",
|
|
38
|
+
"@rushstack/module-minifier": "0.8.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "20.17.19",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"eslint": "~9.25.1",
|
|
45
45
|
"webpack-sources": "~1.4.3",
|
|
46
46
|
"webpack": "~4.47.0",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"@rushstack/heft": "1.1.0",
|
|
48
|
+
"local-node-rig": "1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"sideEffects": [
|
|
51
51
|
"./lib/OverrideWebpackIdentifierAllocation"
|