@rushstack/webpack4-module-minifier-plugin 0.9.4

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.
Files changed (49) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +61 -0
  3. package/dist/tsdoc-metadata.json +11 -0
  4. package/dist/webpack4-module-minifier-plugin.d.ts +346 -0
  5. package/lib/AsyncImportCompressionPlugin.d.ts +14 -0
  6. package/lib/AsyncImportCompressionPlugin.d.ts.map +1 -0
  7. package/lib/AsyncImportCompressionPlugin.js +200 -0
  8. package/lib/AsyncImportCompressionPlugin.js.map +1 -0
  9. package/lib/Constants.d.ts +28 -0
  10. package/lib/Constants.d.ts.map +1 -0
  11. package/lib/Constants.js +33 -0
  12. package/lib/Constants.js.map +1 -0
  13. package/lib/GenerateLicenseFileForAsset.d.ts +13 -0
  14. package/lib/GenerateLicenseFileForAsset.d.ts.map +1 -0
  15. package/lib/GenerateLicenseFileForAsset.js +79 -0
  16. package/lib/GenerateLicenseFileForAsset.js.map +1 -0
  17. package/lib/ModuleMinifierPlugin.d.ts +18 -0
  18. package/lib/ModuleMinifierPlugin.d.ts.map +1 -0
  19. package/lib/ModuleMinifierPlugin.js +439 -0
  20. package/lib/ModuleMinifierPlugin.js.map +1 -0
  21. package/lib/ModuleMinifierPlugin.types.d.ts +217 -0
  22. package/lib/ModuleMinifierPlugin.types.d.ts.map +1 -0
  23. package/lib/ModuleMinifierPlugin.types.js +5 -0
  24. package/lib/ModuleMinifierPlugin.types.js.map +1 -0
  25. package/lib/OverrideWebpackIdentifierAllocation.d.ts +2 -0
  26. package/lib/OverrideWebpackIdentifierAllocation.d.ts.map +1 -0
  27. package/lib/OverrideWebpackIdentifierAllocation.js +9 -0
  28. package/lib/OverrideWebpackIdentifierAllocation.js.map +1 -0
  29. package/lib/ParallelCompiler.d.ts +11 -0
  30. package/lib/ParallelCompiler.d.ts.map +1 -0
  31. package/lib/ParallelCompiler.js +90 -0
  32. package/lib/ParallelCompiler.js.map +1 -0
  33. package/lib/PortableMinifierIdsPlugin.d.ts +13 -0
  34. package/lib/PortableMinifierIdsPlugin.d.ts.map +1 -0
  35. package/lib/PortableMinifierIdsPlugin.js +129 -0
  36. package/lib/PortableMinifierIdsPlugin.js.map +1 -0
  37. package/lib/RehydrateAsset.d.ts +11 -0
  38. package/lib/RehydrateAsset.d.ts.map +1 -0
  39. package/lib/RehydrateAsset.js +143 -0
  40. package/lib/RehydrateAsset.js.map +1 -0
  41. package/lib/index.d.ts +9 -0
  42. package/lib/index.d.ts.map +1 -0
  43. package/lib/index.js +32 -0
  44. package/lib/index.js.map +1 -0
  45. package/lib/workerPool/WebpackWorker.d.ts +2 -0
  46. package/lib/workerPool/WebpackWorker.d.ts.map +1 -0
  47. package/lib/workerPool/WebpackWorker.js +101 -0
  48. package/lib/workerPool/WebpackWorker.js.map +1 -0
  49. package/package.json +56 -0
@@ -0,0 +1,439 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
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
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.ModuleMinifierPlugin = void 0;
29
+ const crypto_1 = require("crypto");
30
+ const webpack_sources_1 = require("webpack-sources");
31
+ const webpack = __importStar(require("webpack"));
32
+ const tapable_1 = require("tapable");
33
+ const Constants_1 = require("./Constants");
34
+ const module_minifier_1 = require("@rushstack/module-minifier");
35
+ const GenerateLicenseFileForAsset_1 = require("./GenerateLicenseFileForAsset");
36
+ const RehydrateAsset_1 = require("./RehydrateAsset");
37
+ const AsyncImportCompressionPlugin_1 = require("./AsyncImportCompressionPlugin");
38
+ const PortableMinifierIdsPlugin_1 = require("./PortableMinifierIdsPlugin");
39
+ require("./OverrideWebpackIdentifierAllocation");
40
+ // The name of the plugin, for use in taps
41
+ const PLUGIN_NAME = 'ModuleMinifierPlugin';
42
+ // Monotonically increasing identifier to be incremented any time the code generation logic changes
43
+ // Will be applied to the webpack hash.
44
+ const CODE_GENERATION_REVISION = 1;
45
+ const TAP_BEFORE = {
46
+ name: PLUGIN_NAME,
47
+ stage: Constants_1.STAGE_BEFORE
48
+ };
49
+ const TAP_AFTER = {
50
+ name: PLUGIN_NAME,
51
+ stage: Constants_1.STAGE_AFTER
52
+ };
53
+ /**
54
+ * https://github.com/webpack/webpack/blob/30e747a55d9e796ae22f67445ae42c7a95a6aa48/lib/Template.js#L36-47
55
+ * @param a first id to be sorted
56
+ * @param b second id to be sorted against
57
+ * @returns the sort value
58
+ */
59
+ function stringifyIdSortPredicate(a, b) {
60
+ const aId = a + '';
61
+ const bId = b + '';
62
+ if (aId < bId)
63
+ return -1;
64
+ if (aId > bId)
65
+ return 1;
66
+ return 0;
67
+ }
68
+ function hashCodeFragment(code) {
69
+ return (0, crypto_1.createHash)('sha256').update(code).digest('hex');
70
+ }
71
+ /**
72
+ * Base implementation of asset rehydration
73
+ *
74
+ * @param dehydratedAssets The dehydrated assets
75
+ * @param compilation The webpack compilation
76
+ */
77
+ function defaultRehydrateAssets(dehydratedAssets, compilation) {
78
+ const { assets, modules } = dehydratedAssets;
79
+ // Now assets/modules contain fully minified code. Rehydrate.
80
+ for (const [assetName, info] of assets) {
81
+ const banner = /\.m?js(\?.+)?$/.test(assetName)
82
+ ? (0, GenerateLicenseFileForAsset_1.generateLicenseFileForAsset)(compilation, info, modules)
83
+ : '';
84
+ const outputSource = (0, RehydrateAsset_1.rehydrateAsset)(info, modules, banner);
85
+ compilation.assets[assetName] = outputSource;
86
+ }
87
+ return dehydratedAssets;
88
+ }
89
+ function isMinificationResultError(result) {
90
+ return !!result.error;
91
+ }
92
+ // Matche behavior of terser's "some" option
93
+ function isLicenseComment(comment) {
94
+ // https://github.com/terser/terser/blob/d3d924fa9e4c57bbe286b811c6068bcc7026e902/lib/output.js#L175
95
+ return /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
96
+ }
97
+ /**
98
+ * Webpack plugin that minifies code on a per-module basis rather than per-asset. The actual minification is handled by the input `minifier` object.
99
+ * @public
100
+ */
101
+ class ModuleMinifierPlugin {
102
+ constructor(options) {
103
+ this.hooks = {
104
+ rehydrateAssets: new tapable_1.AsyncSeriesWaterfallHook(['dehydratedContent', 'compilation']),
105
+ finalModuleId: new tapable_1.SyncWaterfallHook(['id']),
106
+ postProcessCodeFragment: new tapable_1.SyncWaterfallHook(['code', 'context'])
107
+ };
108
+ const { minifier, sourceMap, usePortableModules = false, compressAsyncImports = false } = options;
109
+ this._optionsForHash = {
110
+ ...options,
111
+ minifier: undefined,
112
+ revision: CODE_GENERATION_REVISION
113
+ };
114
+ this._enhancers = [];
115
+ if (usePortableModules) {
116
+ this._enhancers.push(new PortableMinifierIdsPlugin_1.PortableMinifierModuleIdsPlugin(this.hooks));
117
+ }
118
+ if (compressAsyncImports) {
119
+ this._enhancers.push(new AsyncImportCompressionPlugin_1.AsyncImportCompressionPlugin(this.hooks));
120
+ }
121
+ this.hooks.rehydrateAssets.tap(PLUGIN_NAME, defaultRehydrateAssets);
122
+ this.minifier = minifier;
123
+ this._sourceMap = sourceMap;
124
+ }
125
+ apply(compiler) {
126
+ for (const enhancer of this._enhancers) {
127
+ enhancer.apply(compiler);
128
+ }
129
+ const { options: { devtool, mode } } = compiler;
130
+ // The explicit setting is preferred due to accuracy, but try to guess based on devtool
131
+ const useSourceMaps = typeof this._sourceMap === 'boolean'
132
+ ? this._sourceMap
133
+ : typeof devtool === 'string'
134
+ ? devtool.endsWith('source-map')
135
+ : mode === 'production' && devtool !== false;
136
+ this._optionsForHash.sourceMap = useSourceMaps;
137
+ const binaryConfig = Buffer.from(JSON.stringify(this._optionsForHash), 'utf-8');
138
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation, compilationData) => {
139
+ const { normalModuleFactory } = compilationData;
140
+ function addCommentExtraction(parser) {
141
+ parser.hooks.program.tap(PLUGIN_NAME, (program, comments) => {
142
+ parser.state.module.factoryMeta.comments = comments.filter(isLicenseComment);
143
+ });
144
+ }
145
+ normalModuleFactory.hooks.parser.for('javascript/auto').tap(PLUGIN_NAME, addCommentExtraction);
146
+ normalModuleFactory.hooks.parser.for('javascript/dynamic').tap(PLUGIN_NAME, addCommentExtraction);
147
+ normalModuleFactory.hooks.parser.for('javascript/esm').tap(PLUGIN_NAME, addCommentExtraction);
148
+ /**
149
+ * Set of local module ids that have been processed.
150
+ */
151
+ const submittedModules = new Set();
152
+ /**
153
+ * The text and comments of all minified modules.
154
+ */
155
+ const minifiedModules = new Map();
156
+ /**
157
+ * The text and comments of all minified chunks. Most of these are trivial, but the runtime chunk is a bit larger.
158
+ */
159
+ const minifiedAssets = new Map();
160
+ let pendingMinificationRequests = 0;
161
+ /**
162
+ * Indicates that all files have been sent to the minifier and therefore that when pending hits 0, assets can be rehydrated.
163
+ */
164
+ let allRequestsIssued = false;
165
+ let resolveMinifyPromise;
166
+ const getRealId = (id) => this.hooks.finalModuleId.call(id, compilation);
167
+ const postProcessCode = (code, context) => this.hooks.postProcessCodeFragment.call(code, context);
168
+ /**
169
+ * Callback to invoke when a file has finished minifying.
170
+ */
171
+ function onFileMinified() {
172
+ if (--pendingMinificationRequests === 0 && allRequestsIssued) {
173
+ resolveMinifyPromise();
174
+ }
175
+ }
176
+ const { minifier } = this;
177
+ let minifierConnection;
178
+ const requestShortener = compilation.runtimeTemplate.requestShortener;
179
+ /**
180
+ * Extracts the code for the module and sends it to be minified.
181
+ * Currently source maps are explicitly not supported.
182
+ * @param {Source} source
183
+ * @param {Module} mod
184
+ */
185
+ function minifyModule(source, mod) {
186
+ const id = mod.id;
187
+ if (id !== null && !submittedModules.has(id)) {
188
+ // options.chunk contains the current chunk, if needed
189
+ // Render the source, then hash, then persist hash -> module, return a placeholder
190
+ // Initially populate the map with unminified version; replace during callback
191
+ submittedModules.add(id);
192
+ const realId = getRealId(id);
193
+ if (realId !== undefined && !mod.factoryMeta.skipMinification) {
194
+ const wrapped = new webpack_sources_1.ConcatSource(Constants_1.MODULE_WRAPPER_PREFIX + '\n', source, '\n' + Constants_1.MODULE_WRAPPER_SUFFIX);
195
+ const nameForMap = `(modules)/${realId}`;
196
+ const { source: wrappedCode, map } = useSourceMaps
197
+ ? wrapped.sourceAndMap()
198
+ : {
199
+ source: wrapped.source(),
200
+ map: undefined
201
+ };
202
+ const hash = hashCodeFragment(wrappedCode);
203
+ ++pendingMinificationRequests;
204
+ minifier.minify({
205
+ hash,
206
+ code: wrappedCode,
207
+ nameForMap: useSourceMaps ? nameForMap : undefined,
208
+ externals: undefined
209
+ }, (result) => {
210
+ if (isMinificationResultError(result)) {
211
+ compilation.errors.push(result.error);
212
+ }
213
+ else {
214
+ try {
215
+ // Have the source map display the module id instead of the minifier boilerplate
216
+ const sourceForMap = `// ${mod.readableIdentifier(requestShortener)}${wrappedCode.slice(Constants_1.MODULE_WRAPPER_PREFIX.length, -Constants_1.MODULE_WRAPPER_SUFFIX.length)}`;
217
+ const { code: minified, map: minifierMap } = result;
218
+ const rawOutput = useSourceMaps
219
+ ? new webpack_sources_1.SourceMapSource(minified, // Code
220
+ nameForMap, // File
221
+ minifierMap, // Base source map
222
+ sourceForMap, // Source from before transform
223
+ map, // Source Map from before transform
224
+ false // Remove original source
225
+ )
226
+ : new webpack_sources_1.RawSource(minified);
227
+ const unwrapped = new webpack_sources_1.ReplaceSource(rawOutput);
228
+ const len = minified.length;
229
+ unwrapped.replace(0, Constants_1.MODULE_WRAPPER_PREFIX.length - 1, '');
230
+ unwrapped.replace(len - Constants_1.MODULE_WRAPPER_SUFFIX.length, len - 1, '');
231
+ const withIds = postProcessCode(unwrapped, {
232
+ compilation,
233
+ module: mod,
234
+ loggingName: mod.identifier()
235
+ });
236
+ const cached = new webpack_sources_1.CachedSource(withIds);
237
+ const minifiedSize = Buffer.byteLength(cached.source(), 'utf-8');
238
+ mod.factoryMeta.minifiedSize = minifiedSize;
239
+ minifiedModules.set(realId, {
240
+ source: cached,
241
+ module: mod
242
+ });
243
+ }
244
+ catch (err) {
245
+ compilation.errors.push(err);
246
+ }
247
+ }
248
+ onFileMinified();
249
+ });
250
+ }
251
+ else {
252
+ // Route any other modules straight through
253
+ const cached = new webpack_sources_1.CachedSource(postProcessCode(new webpack_sources_1.ReplaceSource(source), {
254
+ compilation,
255
+ module: mod,
256
+ loggingName: mod.identifier()
257
+ }));
258
+ const minifiedSize = Buffer.byteLength(cached.source(), 'utf-8');
259
+ mod.factoryMeta.minifiedSize = minifiedSize;
260
+ minifiedModules.set(realId !== undefined ? realId : id, {
261
+ source: cached,
262
+ module: mod
263
+ });
264
+ }
265
+ }
266
+ // Return something so that this stage still produces valid ECMAScript
267
+ return new webpack_sources_1.RawSource('(function(){})');
268
+ }
269
+ const jsTemplate = compilation.moduleTemplates
270
+ .javascript;
271
+ const innerRender = jsTemplate.render.bind(jsTemplate);
272
+ // The optimizeTree hook is the last async hook that occurs before chunk rendering
273
+ compilation.hooks.optimizeTree.tapPromise(PLUGIN_NAME, async () => {
274
+ minifierConnection = await minifier.connect();
275
+ submittedModules.clear();
276
+ const cache = new WeakSet();
277
+ const defaultSource = new webpack_sources_1.RawSource('');
278
+ // During code generation, send the generated code to the minifier and replace with a placeholder
279
+ // Hacking this to avoid calling .source() on a concatenated module multiple times
280
+ jsTemplate.render = (module, dependencyTemplates, options) => {
281
+ if (!cache.has(module)) {
282
+ cache.add(module);
283
+ const rendered = innerRender(module, dependencyTemplates, options);
284
+ minifyModule(rendered, module);
285
+ }
286
+ return defaultSource;
287
+ };
288
+ });
289
+ // This should happen before any other tasks that operate during optimizeChunkAssets
290
+ compilation.hooks.optimizeChunkAssets.tapPromise(TAP_BEFORE, async (chunks) => {
291
+ // Still need to minify the rendered assets
292
+ for (const chunk of chunks) {
293
+ const externals = [];
294
+ const externalNames = new Map();
295
+ const chunkModuleSet = new Set();
296
+ const allChunkModules = chunk.modulesIterable;
297
+ let hasNonNumber = false;
298
+ for (const mod of allChunkModules) {
299
+ if (mod.id !== null) {
300
+ if (typeof mod.id !== 'number') {
301
+ hasNonNumber = true;
302
+ }
303
+ chunkModuleSet.add(mod.id);
304
+ if (mod.external) {
305
+ // Match the identifiers generated in the AmdMainTemplatePlugin
306
+ // https://github.com/webpack/webpack/blob/444e59f8a427f94f0064cae6765e5a3c4b78596d/lib/AmdMainTemplatePlugin.js#L49
307
+ const key = `__WEBPACK_EXTERNAL_MODULE_${webpack.Template.toIdentifier(`${mod.id}`)}__`;
308
+ // The first two identifiers are used for function (module, exports) at the module site
309
+ const ordinal = 2 + externals.length;
310
+ const miniId = (0, module_minifier_1.getIdentifier)(ordinal);
311
+ externals.push(key);
312
+ externalNames.set(key, miniId);
313
+ }
314
+ }
315
+ }
316
+ const chunkModules = Array.from(chunkModuleSet);
317
+ // Sort by id before rehydration in case we rehydrate a given chunk multiple times
318
+ chunkModules.sort(hasNonNumber
319
+ ? stringifyIdSortPredicate
320
+ : (x, y) => x - y);
321
+ for (const assetName of chunk.files) {
322
+ const asset = compilation.assets[assetName];
323
+ // Verify that this is a JS asset
324
+ if (/\.m?js(\?.+)?$/.test(assetName)) {
325
+ ++pendingMinificationRequests;
326
+ const rawCode = asset.source();
327
+ const nameForMap = `(chunks)/${assetName}`;
328
+ const hash = hashCodeFragment(rawCode);
329
+ minifier.minify({
330
+ hash,
331
+ code: rawCode,
332
+ nameForMap: useSourceMaps ? nameForMap : undefined,
333
+ externals
334
+ }, (result) => {
335
+ if (isMinificationResultError(result)) {
336
+ compilation.errors.push(result.error);
337
+ console.error(result.error);
338
+ }
339
+ else {
340
+ try {
341
+ const { code: minified, map: minifierMap } = result;
342
+ let codeForMap = rawCode;
343
+ if (useSourceMaps) {
344
+ // 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
345
+ codeForMap = codeForMap.replace(Constants_1.CHUNK_MODULES_TOKEN, JSON.stringify(chunkModules, undefined, 2));
346
+ }
347
+ const rawOutput = useSourceMaps
348
+ ? new webpack_sources_1.SourceMapSource(minified, // Code
349
+ nameForMap, // File
350
+ minifierMap, // Base source map
351
+ codeForMap, // Source from before transform
352
+ undefined, // Source Map from before transform
353
+ false // Remove original source
354
+ )
355
+ : new webpack_sources_1.RawSource(minified);
356
+ const withIds = postProcessCode(new webpack_sources_1.ReplaceSource(rawOutput), {
357
+ compilation,
358
+ module: undefined,
359
+ loggingName: assetName
360
+ });
361
+ minifiedAssets.set(assetName, {
362
+ source: new webpack_sources_1.CachedSource(withIds),
363
+ modules: chunkModules,
364
+ chunk,
365
+ fileName: assetName,
366
+ externalNames
367
+ });
368
+ }
369
+ catch (err) {
370
+ compilation.errors.push(err);
371
+ }
372
+ }
373
+ onFileMinified();
374
+ });
375
+ }
376
+ else {
377
+ // 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.
378
+ minifiedAssets.set(assetName, {
379
+ // Still need to restore ids
380
+ source: postProcessCode(new webpack_sources_1.ReplaceSource(asset), {
381
+ compilation,
382
+ module: undefined,
383
+ loggingName: assetName
384
+ }),
385
+ modules: chunkModules,
386
+ chunk,
387
+ fileName: assetName,
388
+ externalNames
389
+ });
390
+ }
391
+ }
392
+ }
393
+ allRequestsIssued = true;
394
+ if (pendingMinificationRequests) {
395
+ await new Promise((resolve) => {
396
+ resolveMinifyPromise = resolve;
397
+ });
398
+ }
399
+ // Handle any error from the minifier.
400
+ await (minifierConnection === null || minifierConnection === void 0 ? void 0 : minifierConnection.disconnect());
401
+ // All assets and modules have been minified, hand them off to be rehydrated
402
+ await this.hooks.rehydrateAssets.promise({
403
+ assets: minifiedAssets,
404
+ modules: minifiedModules
405
+ }, compilation);
406
+ });
407
+ function updateChunkHash(hash, chunk) {
408
+ // Apply the options hash
409
+ hash.update(binaryConfig);
410
+ // Apply the hash from the minifier
411
+ if (minifierConnection) {
412
+ hash.update(minifierConnection.configHash, 'utf8');
413
+ }
414
+ }
415
+ // Need to update chunk hashes with information from this plugin
416
+ compilation.chunkTemplate.hooks.hashForChunk.tap(PLUGIN_NAME, updateChunkHash);
417
+ compilation.mainTemplate.hooks.hashForChunk.tap(PLUGIN_NAME, updateChunkHash);
418
+ // This function is written twice because the parameter order is not the same between the two hooks
419
+ compilation.chunkTemplate.hooks.modules.tap(TAP_AFTER, (source, chunk, moduleTemplate) => {
420
+ if (moduleTemplate !== compilation.moduleTemplates.javascript) {
421
+ // This is not a JavaScript asset
422
+ return source;
423
+ }
424
+ // Discard the rendered modules
425
+ return new webpack_sources_1.RawSource(Constants_1.CHUNK_MODULES_TOKEN);
426
+ });
427
+ compilation.mainTemplate.hooks.modules.tap(TAP_AFTER, (source, chunk, hash, moduleTemplate) => {
428
+ if (moduleTemplate !== compilation.moduleTemplates.javascript) {
429
+ // This is not a JavaScript asset
430
+ return source;
431
+ }
432
+ // Discard the rendered modules
433
+ return new webpack_sources_1.RawSource(Constants_1.CHUNK_MODULES_TOKEN);
434
+ });
435
+ });
436
+ }
437
+ }
438
+ exports.ModuleMinifierPlugin = ModuleMinifierPlugin;
439
+ //# sourceMappingURL=ModuleMin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gBAC/B,OAAO,IAAI,2BAAS,CAAC,+BAAmB,CAAC,CAAC;YAC5C,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAjdD,oDAidC","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, Hash } from 'crypto';\n\nimport {\n CachedSource,\n ConcatSource,\n RawSource,\n ReplaceSource,\n Source,\n SourceMapSource\n} from 'webpack-sources';\nimport * as webpack from 'webpack';\nimport { AsyncSeriesWaterfallHook, SyncHook, SyncWaterfallHook, 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 {\n IModuleMinifierPluginOptions,\n IModuleMap,\n IAssetMap,\n IExtendedModule,\n IModuleMinifierPluginHooks,\n IPostProcessFragmentContext,\n IDehydratedAssets,\n _IWebpackCompilationData,\n _IAcornComment\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\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 // 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);\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 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 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: (code: ReplaceSource, context: IPostProcessFragmentContext) => ReplaceSource =\n (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.connect();\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 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 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 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?.disconnect();\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"]}