@rushstack/webpack4-module-minifier-plugin 0.13.91 → 0.13.93

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 CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@rushstack/webpack4-module-minifier-plugin",
3
3
  "entries": [
4
+ {
5
+ "version": "0.13.93",
6
+ "tag": "@rushstack/webpack4-module-minifier-plugin_v0.13.93",
7
+ "date": "Tue, 11 Mar 2025 02:12:34 GMT",
8
+ "comments": {
9
+ "dependency": [
10
+ {
11
+ "comment": "Updating dependency \"@rushstack/module-minifier\" to `0.7.10`"
12
+ },
13
+ {
14
+ "comment": "Updating dependency \"@rushstack/worker-pool\" to `0.5.10`"
15
+ },
16
+ {
17
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.70.0`"
18
+ }
19
+ ]
20
+ }
21
+ },
22
+ {
23
+ "version": "0.13.92",
24
+ "tag": "@rushstack/webpack4-module-minifier-plugin_v0.13.92",
25
+ "date": "Tue, 11 Mar 2025 00:11:25 GMT",
26
+ "comments": {
27
+ "dependency": [
28
+ {
29
+ "comment": "Updating dependency \"@rushstack/module-minifier\" to `0.7.9`"
30
+ },
31
+ {
32
+ "comment": "Updating dependency \"@rushstack/worker-pool\" to `0.5.9`"
33
+ },
34
+ {
35
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.69.3`"
36
+ }
37
+ ]
38
+ }
39
+ },
4
40
  {
5
41
  "version": "0.13.91",
6
42
  "tag": "@rushstack/webpack4-module-minifier-plugin_v0.13.91",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Change Log - @rushstack/webpack4-module-minifier-plugin
2
2
 
3
- This log was last generated on Sat, 01 Mar 2025 05:00:09 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 11 Mar 2025 02:12:34 GMT and should not be manually modified.
4
+
5
+ ## 0.13.93
6
+ Tue, 11 Mar 2025 02:12:34 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 0.13.92
11
+ Tue, 11 Mar 2025 00:11:25 GMT
12
+
13
+ _Version update only_
4
14
 
5
15
  ## 0.13.91
6
16
  Sat, 01 Mar 2025 05:00:09 GMT
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.51.0"
8
+ "packageVersion": "7.52.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -17,15 +17,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
17
17
  }) : function(o, v) {
18
18
  o["default"] = v;
19
19
  });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
27
37
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.generateLicenseFileForAsset = void 0;
38
+ exports.generateLicenseFileForAsset = generateLicenseFileForAsset;
29
39
  const path = __importStar(require("path"));
30
40
  const webpack_sources_1 = require("webpack-sources");
31
41
  function getAllComments(moduleIds, minifiedModules) {
@@ -75,5 +85,4 @@ function generateLicenseFileForAsset(compilation, asset, minifiedModules) {
75
85
  }
76
86
  return banner;
77
87
  }
78
- exports.generateLicenseFileForAsset = generateLicenseFileForAsset;
79
88
  //# sourceMappingURL=GenerateLicenseFileForAsset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GenerateLicenseFileForAsset.js","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAE7B,qDAA+C;AAS/C,SAAS,cAAc,CAAC,SAA8B,EAAE,eAA2B;IACjF,MAAM,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IAE3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,GAAG,GAA4B,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,SAAS;QACX,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC;QACtC,MAAM,OAAO,GAAsB,aAAa,CAAC,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5E,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE,CAAC;YAChC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC,WAEjD,CAAC;YACF,IAAI,iBAAiB,EAAE,CAAC;gBACtB,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;oBACxC,MAAM,KAAK,GAAW,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,MAAM,CAAC;oBAClG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,2BAA2B,CACzC,WAA4C,EAC5C,KAAiB,EACjB,eAA2B;IAE3B,uCAAuC;IACvC,MAAM,QAAQ,GAAgB,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;AAxBD,kEAwBC","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 'path';\nimport type * as webpack from 'webpack';\nimport { ConcatSource } from 'webpack-sources';\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
+ {"version":3,"file":"GenerateLicenseFileForAsset.js","sourceRoot":"","sources":["../src/GenerateLicenseFileForAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiD3D,kEAwBC;AAvED,2CAA6B;AAE7B,qDAA+C;AAS/C,SAAS,cAAc,CAAC,SAA8B,EAAE,eAA2B;IACjF,MAAM,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IAE3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,GAAG,GAA4B,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,SAAS;QACX,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC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AC,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 'path';\nimport type * as webpack from 'webpack';\nimport { ConcatSource } from 'webpack-sources';\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"]}
@@ -17,13 +17,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
17
17
  }) : function(o, v) {
18
18
  o["default"] = v;
19
19
  });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
27
37
  Object.defineProperty(exports, "__esModule", { value: true });
28
38
  exports.ModuleMinifierPlugin = void 0;
29
39
  const crypto_1 = require("crypto");
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleMinifierPlugin.js","sourceRoot":"","sources":["../src/ModuleMinifierPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,mCAA+C;AAE/C,qDAOyB;AACzB,iDAAmC;AACnC,qCAAsG;AAEtG,2CAMqB;AAOrB,gEAA2D;AAe3D,+EAA4E;AAC5E,qDAAkD;AAClD,iFAA8E;AAC9E,2EAA8E;AAE9E,iDAA+C;AAE/C,0CAA0C;AAC1C,MAAM,WAAW,GAA2B,sBAAsB,CAAC;AAEnE,mGAAmG;AACnG,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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,mCAA+C;AAE/C,qDAOyB;AACzB,iDAAmC;AACnC,qCAAsG;AAEtG,2CAMqB;AAOrB,gEAA2D;AAe3D,+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;AAE3C,MAAM,UAAU,GAA0B;IACxC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,wBAAY;CACpB,CAAC;AACF,MAAM,SAAS,GAAuB;IACpC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,uBAAW;CACnB,CAAC;AAwBF,MAAM,sBAAsB,GAC1B,IAAI,OAAO,EAAE,CAAC;AAEhB;;;;;GAKG;AACH,SAAS,wBAAwB,CAAC,CAAkB,EAAE,CAAkB;IACtE,MAAM,GAAG,GAAW,CAAC,GAAG,EAAE,CAAC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,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"]}
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.runParallel = void 0;
8
+ exports.runParallel = runParallel;
9
9
  const os_1 = __importDefault(require("os"));
10
10
  const path_1 = require("path");
11
11
  const module_minifier_1 = require("@rushstack/module-minifier");
@@ -93,5 +93,4 @@ async function runParallel(options) {
93
93
  await webpackPool.finishAsync();
94
94
  await minifierConnection.disconnectAsync();
95
95
  }
96
- exports.runParallel = runParallel;
97
96
  //# sourceMappingURL=ParallelCompiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ParallelCompiler.js","sourceRoot":"","sources":["../src/ParallelCompiler.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,4CAAoB;AACpB,+BAA+B;AAW/B,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,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,EA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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;AAtFD,kCAsFC","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 'os';\nimport { resolve } from 'path';\nimport type { Worker } from '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\n const rawConfig: Configuration | Configuration[] = require(resolvedPath); // eslint-disable-line @typescript-eslint/no-var-requires\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
+ {"version":3,"file":"ParallelCompiler.js","sourceRoot":"","sources":["../src/ParallelCompiler.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAuD3D,kCAsFC;AA3ID,4CAAoB;AACpB,+BAA+B;AAW/B,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,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,CAAC;QACtB,IAAI,GAAG,GAAG,CAAC;QACX,QAAQ,G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I,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 'os';\nimport { resolve } from 'path';\nimport type { Worker } from '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\n const rawConfig: Configuration | Configuration[] = require(resolvedPath); // eslint-disable-line @typescript-eslint/no-var-requires\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"]}
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.rehydrateAsset = void 0;
5
+ exports.rehydrateAsset = rehydrateAsset;
6
6
  const webpack_sources_1 = require("webpack-sources");
7
7
  const Constants_1 = require("./Constants");
8
8
  /**
@@ -146,7 +146,6 @@ function rehydrateAsset(asset, moduleMap, banner, emitRenderInfo) {
146
146
  source.add(suffix);
147
147
  return handleExternals(new webpack_sources_1.CachedSource(source), asset);
148
148
  }
149
- exports.rehydrateAsset = rehydrateAsset;
150
149
  function handleExternals(source, asset) {
151
150
  const { externalNames } = asset;
152
151
  if (externalNames.size) {
@@ -1 +1 @@
1
- {"version":3,"file":"RehydrateAsset.js","sourceRoot":"","sources":["../src/RehydrateAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,qDAAyF;AAEzF,2CAAkD;AAGlD;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,KAAiB,EACjB,SAAqB,EACrB,MAAc,EACd,cAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE/C,MAAM,SAAS,GAAW,WAAW,CAAC,MAAM,EAAY,CAAC;IAEzD,MAAM,UAAU,GAAW,SAAS,CAAC,OAAO,CAAC,+BAAm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AO,CAAC,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC5C,MAAM,EAAE,GAAW,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,MAAM,MAAM,GAAuB,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAEzD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,sCAAsC;gBACtC,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAO,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACN,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,SAAS,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;QAED,OAAO,IAAI,8BAAY,CAAC,aAAa,CAAC,CAAC;IACzC,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 { CachedSource, ConcatSource, ReplaceSource, type Source } from 'webpack-sources';\n\nimport { CHUNK_MODULES_TOKEN } from './Constants';\nimport type { IAssetInfo, IModuleMap, IModuleInfo } from './ModuleMinifierPlugin.types';\n\n/**\n * Rehydrates an asset with minified modules.\n * @param asset - The asset\n * @param moduleMap - The minified modules\n * @param banner - A banner to inject for license information\n * @param emitRenderInfo - If set, provide information about module offsets\n * @public\n */\nexport function rehydrateAsset(\n asset: IAssetInfo,\n moduleMap: IModuleMap,\n banner: string,\n emitRenderInfo?: boolean\n): Source {\n const { source: assetSource, modules } = asset;\n\n const assetCode: string = assetSource.source() as string;\n\n const tokenIndex: number = assetCode.indexOf(CHUNK_MODULES_TOKEN);\n if (tokenIndex < 0) {\n // This is not a JS asset.\n return handleExternals(assetSource, asset);\n }\n const suffixStart: number = tokenIndex + CHUNK_MODULES_TOKEN.length;\n const suffix: string = assetCode.slice(suffixStart);\n\n const prefix: ReplaceSource = new ReplaceSource(assetSource);\n // Preserve source map via fiddly logic\n prefix.replace(tokenIndex, assetCode.length, '');\n\n if (!modules.length) {\n // Empty chunk, degenerate case\n return new ConcatSource(banner, prefix, '[]', suffix);\n }\n\n const emptyFunction = 'function(){}'; // eslint-disable-line @typescript-eslint/typedef\n // This must not have the global flag set\n const validIdRegex: RegExp = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n const source: ConcatSource = new ConcatSource(banner, prefix);\n // Source.size() is in bytes, we want characters\n let charOffset: number = source.source().length;\n\n const firstModuleId: string | number = modules[0];\n const lastModuleId: string | number = modules[modules.length - 1];\n\n // Extended logic from webpack.Template.getModulesArrayBounds\n const minId: number = typeof firstModuleId === 'number' ? firstModuleId : 0;\n const maxId: number = typeof lastModuleId === 'number' ? lastModuleId : Infinity;\n\n const simpleArrayOverhead: number = 2 + maxId;\n let concatArrayOverhead: number = simpleArrayOverhead + 9;\n\n let useObject: boolean = typeof firstModuleId !== 'number' || typeof lastModuleId !== 'number';\n let objectOverhead: number = 1;\n let lastId: number = 0;\n\n if (!useObject) {\n for (const id of modules) {\n if (typeof id !== 'number') {\n // This must be an object\n useObject = true;\n break;\n }\n\n // This is the extension from webpack.Template.getModulesArrayBounds\n // We can make smaller emit by injecting additional filler arrays\n const delta: number = id - lastId - 1;\n\n // Compare the length of `],Array(${delta}),[` to ','.repeat(delta + 1)\n const threshold: number = (lastId === 0 ? 7 : 11) + ('' + delta).length;\n const fillerArraySavings: number = delta + 1 - threshold;\n if (fillerArraySavings > 0) {\n concatArrayOverhead -= fillerArraySavings;\n }\n\n objectOverhead += 2 + ('' + id).length;\n lastId = id;\n }\n }\n\n const useConcat: boolean = concatArrayOverhead < simpleArrayOverhead;\n\n const arrayOverhead: number = useConcat ? concatArrayOverhead : simpleArrayOverhead;\n\n useObject = useObject || objectOverhead < arrayOverhead;\n\n if (useObject) {\n // Write an object literal\n let separator: '{' | ',' = '{';\n for (const id of modules) {\n // If the id is legal to use as a key in a JavaScript object literal, use as-is\n const javascriptId: string | number =\n typeof id !== 'string' || validIdRegex.test(id) ? id : JSON.stringify(id);\n const currentSeparator: string = `${separator}${javascriptId}:`;\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n\n separator = ',';\n\n const item: IModuleInfo | undefined = moduleMap.get(id);\n const moduleCode: Source | string = item ? item.source : emptyFunction;\n // Source.size() is in bytes, we want characters\n const charLength: number =\n typeof moduleCode === 'string' ? moduleCode.length : moduleCode.source().toString().length;\n\n if (emitRenderInfo) {\n asset.renderInfo.set(id, {\n charOffset,\n charLength\n });\n }\n\n source.add(moduleCode);\n charOffset += charLength;\n }\n\n source.add('}');\n } else {\n // Write one or more array literals, joined by Array(gap) expressions\n\n // There will never be more than 16 + (\"\" + minId).length consecutive commas, so 40 is more than will ever be used\n // This is because the above criteria triggers an Array(len) expression instead\n const enoughCommas: string = ',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';\n\n const useConcatAtStart: boolean = useConcat && minId > 8;\n lastId = useConcatAtStart ? minId : 0;\n // TODO: Just because we want to use concat elsewhere doesn't mean its optimal to use at the start\n let separator: string = useConcatAtStart ? `Array(${minId}).concat([` : '[';\n let concatInserted: boolean = useConcatAtStart;\n for (const id of modules) {\n const delta: number = (id as number) - lastId - 1;\n const deltaStr: string = '' + delta;\n const fillerArrayThreshold: number = 11 + deltaStr.length;\n\n const item: IModuleInfo | undefined = moduleMap.get(id);\n const moduleCode: Source | string = item ? item.source : emptyFunction;\n // Source.size() is in bytes, we want characters\n const charLength: number =\n typeof moduleCode === 'string' ? moduleCode.length : moduleCode.source().toString().length;\n\n if (useConcat && delta + 1 > fillerArrayThreshold) {\n if (concatInserted) {\n const currentSeparator: string = `],Array(${deltaStr}),[`;\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n } else {\n const currentSeparator: string = `].concat(Array(${deltaStr}),[`;\n concatInserted = true;\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n }\n } else {\n const currentSeparator: string = separator + enoughCommas.slice(0, delta + 1);\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n }\n lastId = id as number;\n\n if (emitRenderInfo) {\n asset.renderInfo.set(id, {\n charOffset,\n charLength\n });\n }\n\n source.add(moduleCode);\n charOffset += charLength;\n\n separator = '';\n }\n\n source.add(useConcat ? '])' : ']');\n }\n\n source.add(suffix);\n\n return handleExternals(new CachedSource(source), asset);\n}\n\nfunction handleExternals(source: Source, asset: IAssetInfo): Source {\n const { externalNames } = asset;\n\n if (externalNames.size) {\n const replaceSource: ReplaceSource = new ReplaceSource(source);\n const code: string = source.source() as string;\n\n const externalIdRegex: RegExp = /__WEBPACK_EXTERNAL_MODULE_[A-Za-z0-9_$]+/g;\n\n // RegExp.exec uses null or an array as the return type, explicitly\n let match: RegExpExecArray | null = null;\n while ((match = externalIdRegex.exec(code))) {\n const id: string = match[0];\n const mapped: string | undefined = externalNames.get(id);\n\n if (mapped === undefined) {\n // eslint-disable-next-line no-console\n console.error(`Missing minified external for ${id} in ${asset.fileName}!`);\n } else {\n replaceSource.replace(match.index, externalIdRegex.lastIndex - 1, mapped);\n }\n }\n\n return new CachedSource(replaceSource);\n }\n\n return source;\n}\n"]}
1
+ {"version":3,"file":"RehydrateAsset.js","sourceRoot":"","sources":["../src/RehydrateAsset.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAe3D,wCA8KC;AA3LD,qDAAyF;AAEzF,2CAAkD;AAGlD;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,KAAiB,EACjB,SAAqB,EACrB,MAAc,EACd,cAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE/C,MAAM,SAAS,GAAW,WAAW,CAAC,MAAM,EAAY,CAAC;IAEzD,MAAM,UAAU,GAAW,SAAS,CAAC,OAAO,CAAC,+BAAmB,CAAC,CAAC;IAClE,I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I,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC5C,MAAM,EAAE,GAAW,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,MAAM,MAAM,GAAuB,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAEzD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,sCAAsC;gBACtC,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAO,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACN,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,SAAS,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;QAED,OAAO,IAAI,8BAAY,CAAC,aAAa,CAAC,CAAC;IACzC,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 { CachedSource, ConcatSource, ReplaceSource, type Source } from 'webpack-sources';\n\nimport { CHUNK_MODULES_TOKEN } from './Constants';\nimport type { IAssetInfo, IModuleMap, IModuleInfo } from './ModuleMinifierPlugin.types';\n\n/**\n * Rehydrates an asset with minified modules.\n * @param asset - The asset\n * @param moduleMap - The minified modules\n * @param banner - A banner to inject for license information\n * @param emitRenderInfo - If set, provide information about module offsets\n * @public\n */\nexport function rehydrateAsset(\n asset: IAssetInfo,\n moduleMap: IModuleMap,\n banner: string,\n emitRenderInfo?: boolean\n): Source {\n const { source: assetSource, modules } = asset;\n\n const assetCode: string = assetSource.source() as string;\n\n const tokenIndex: number = assetCode.indexOf(CHUNK_MODULES_TOKEN);\n if (tokenIndex < 0) {\n // This is not a JS asset.\n return handleExternals(assetSource, asset);\n }\n const suffixStart: number = tokenIndex + CHUNK_MODULES_TOKEN.length;\n const suffix: string = assetCode.slice(suffixStart);\n\n const prefix: ReplaceSource = new ReplaceSource(assetSource);\n // Preserve source map via fiddly logic\n prefix.replace(tokenIndex, assetCode.length, '');\n\n if (!modules.length) {\n // Empty chunk, degenerate case\n return new ConcatSource(banner, prefix, '[]', suffix);\n }\n\n const emptyFunction = 'function(){}'; // eslint-disable-line @typescript-eslint/typedef\n // This must not have the global flag set\n const validIdRegex: RegExp = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n const source: ConcatSource = new ConcatSource(banner, prefix);\n // Source.size() is in bytes, we want characters\n let charOffset: number = source.source().length;\n\n const firstModuleId: string | number = modules[0];\n const lastModuleId: string | number = modules[modules.length - 1];\n\n // Extended logic from webpack.Template.getModulesArrayBounds\n const minId: number = typeof firstModuleId === 'number' ? firstModuleId : 0;\n const maxId: number = typeof lastModuleId === 'number' ? lastModuleId : Infinity;\n\n const simpleArrayOverhead: number = 2 + maxId;\n let concatArrayOverhead: number = simpleArrayOverhead + 9;\n\n let useObject: boolean = typeof firstModuleId !== 'number' || typeof lastModuleId !== 'number';\n let objectOverhead: number = 1;\n let lastId: number = 0;\n\n if (!useObject) {\n for (const id of modules) {\n if (typeof id !== 'number') {\n // This must be an object\n useObject = true;\n break;\n }\n\n // This is the extension from webpack.Template.getModulesArrayBounds\n // We can make smaller emit by injecting additional filler arrays\n const delta: number = id - lastId - 1;\n\n // Compare the length of `],Array(${delta}),[` to ','.repeat(delta + 1)\n const threshold: number = (lastId === 0 ? 7 : 11) + ('' + delta).length;\n const fillerArraySavings: number = delta + 1 - threshold;\n if (fillerArraySavings > 0) {\n concatArrayOverhead -= fillerArraySavings;\n }\n\n objectOverhead += 2 + ('' + id).length;\n lastId = id;\n }\n }\n\n const useConcat: boolean = concatArrayOverhead < simpleArrayOverhead;\n\n const arrayOverhead: number = useConcat ? concatArrayOverhead : simpleArrayOverhead;\n\n useObject = useObject || objectOverhead < arrayOverhead;\n\n if (useObject) {\n // Write an object literal\n let separator: '{' | ',' = '{';\n for (const id of modules) {\n // If the id is legal to use as a key in a JavaScript object literal, use as-is\n const javascriptId: string | number =\n typeof id !== 'string' || validIdRegex.test(id) ? id : JSON.stringify(id);\n const currentSeparator: string = `${separator}${javascriptId}:`;\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n\n separator = ',';\n\n const item: IModuleInfo | undefined = moduleMap.get(id);\n const moduleCode: Source | string = item ? item.source : emptyFunction;\n // Source.size() is in bytes, we want characters\n const charLength: number =\n typeof moduleCode === 'string' ? moduleCode.length : moduleCode.source().toString().length;\n\n if (emitRenderInfo) {\n asset.renderInfo.set(id, {\n charOffset,\n charLength\n });\n }\n\n source.add(moduleCode);\n charOffset += charLength;\n }\n\n source.add('}');\n } else {\n // Write one or more array literals, joined by Array(gap) expressions\n\n // There will never be more than 16 + (\"\" + minId).length consecutive commas, so 40 is more than will ever be used\n // This is because the above criteria triggers an Array(len) expression instead\n const enoughCommas: string = ',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';\n\n const useConcatAtStart: boolean = useConcat && minId > 8;\n lastId = useConcatAtStart ? minId : 0;\n // TODO: Just because we want to use concat elsewhere doesn't mean its optimal to use at the start\n let separator: string = useConcatAtStart ? `Array(${minId}).concat([` : '[';\n let concatInserted: boolean = useConcatAtStart;\n for (const id of modules) {\n const delta: number = (id as number) - lastId - 1;\n const deltaStr: string = '' + delta;\n const fillerArrayThreshold: number = 11 + deltaStr.length;\n\n const item: IModuleInfo | undefined = moduleMap.get(id);\n const moduleCode: Source | string = item ? item.source : emptyFunction;\n // Source.size() is in bytes, we want characters\n const charLength: number =\n typeof moduleCode === 'string' ? moduleCode.length : moduleCode.source().toString().length;\n\n if (useConcat && delta + 1 > fillerArrayThreshold) {\n if (concatInserted) {\n const currentSeparator: string = `],Array(${deltaStr}),[`;\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n } else {\n const currentSeparator: string = `].concat(Array(${deltaStr}),[`;\n concatInserted = true;\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n }\n } else {\n const currentSeparator: string = separator + enoughCommas.slice(0, delta + 1);\n\n source.add(currentSeparator);\n charOffset += currentSeparator.length;\n }\n lastId = id as number;\n\n if (emitRenderInfo) {\n asset.renderInfo.set(id, {\n charOffset,\n charLength\n });\n }\n\n source.add(moduleCode);\n charOffset += charLength;\n\n separator = '';\n }\n\n source.add(useConcat ? '])' : ']');\n }\n\n source.add(suffix);\n\n return handleExternals(new CachedSource(source), asset);\n}\n\nfunction handleExternals(source: Source, asset: IAssetInfo): Source {\n const { externalNames } = asset;\n\n if (externalNames.size) {\n const replaceSource: ReplaceSource = new ReplaceSource(source);\n const code: string = source.source() as string;\n\n const externalIdRegex: RegExp = /__WEBPACK_EXTERNAL_MODULE_[A-Za-z0-9_$]+/g;\n\n // RegExp.exec uses null or an array as the return type, explicitly\n let match: RegExpExecArray | null = null;\n while ((match = externalIdRegex.exec(code))) {\n const id: string = match[0];\n const mapped: string | undefined = externalNames.get(id);\n\n if (mapped === undefined) {\n // eslint-disable-next-line no-console\n console.error(`Missing minified external for ${id} in ${asset.fileName}!`);\n } else {\n replaceSource.replace(match.index, externalIdRegex.lastIndex - 1, mapped);\n }\n }\n\n return new CachedSource(replaceSource);\n }\n\n return source;\n}\n"]}
@@ -17,13 +17,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
17
17
  }) : function(o, v) {
18
18
  o["default"] = v;
19
19
  });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
27
37
  Object.defineProperty(exports, "__esModule", { value: true });
28
38
  const webpack = require("webpack");
29
39
  const workerThreads = __importStar(require("worker_threads"));
@@ -1 +1 @@
1
- {"version":3,"file":"WebpackWorker.js","sourceRoot":"","sources":["../../src/workerPool/WebpackWorker.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,mCAAoC;AACpC,8DAAgD;AAChD,gEAAiE;AACjE,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,CAAC,yDAAyD;AAElI,+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,SAAS,EAAE,GAAG,YAAY,CAAC;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C,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 webpack = require('webpack');\nimport * as workerThreads from 'worker_threads';\nimport { MessagePortMinifier } from '@rushstack/module-minifier';\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); // eslint-disable-line @typescript-eslint/no-var-requires\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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,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 webpack = require('webpack');\nimport * as workerThreads from 'worker_threads';\nimport { MessagePortMinifier } from '@rushstack/module-minifier';\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); // eslint-disable-line @typescript-eslint/no-var-requires\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.13.91",
3
+ "version": "0.13.93",
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,15 +34,16 @@
34
34
  "dependencies": {
35
35
  "@types/tapable": "1.0.6",
36
36
  "tapable": "1.1.3",
37
- "@rushstack/module-minifier": "0.7.8",
38
- "@rushstack/worker-pool": "0.5.8"
37
+ "@rushstack/module-minifier": "0.7.10",
38
+ "@rushstack/worker-pool": "0.5.10"
39
39
  },
40
40
  "devDependencies": {
41
- "@types/webpack": "4.41.32",
41
+ "@types/node": "20.17.19",
42
42
  "@types/webpack-sources": "1.4.2",
43
- "webpack": "~4.47.0",
43
+ "@types/webpack": "4.41.32",
44
44
  "webpack-sources": "~1.4.3",
45
- "@rushstack/heft": "0.69.2",
45
+ "webpack": "~4.47.0",
46
+ "@rushstack/heft": "0.70.0",
46
47
  "local-node-rig": "1.0.0"
47
48
  },
48
49
  "sideEffects": [