/
TerserPlugin.test.js.snap.webpack5
556 lines (444 loc) · 26.4 KB
/
TerserPlugin.test.js.snap.webpack5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TerserPlugin buildError method 1`] = `
[Error: test.js from Terser
Message]
`;
exports[`TerserPlugin buildError method 2`] = `
[Error: test.js from Terser
Message [test.js:1,1]]
`;
exports[`TerserPlugin buildError method 3`] = `
[Error: test.js from Terser
Message [http://example.com/www/js/one.js:1,1][test.js:1,1]]
`;
exports[`TerserPlugin buildError method 4`] = `
[Error: test.js from Terser
Stack]
`;
exports[`TerserPlugin should emit an error on a broken code in not parallel mode: assets 1`] = `
Object {
"broken.js": "\`Broken===",
"one.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
"two.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should emit an error on a broken code in not parallel mode: errors 1`] = `
Array [
"Error: broken.js from Terser
Unterminated template [broken.js:1,0]",
]
`;
exports[`TerserPlugin should emit an error on a broken code in not parallel mode: warnings 1`] = `Array []`;
exports[`TerserPlugin should emit an error on a broken code in parallel mode: assets 1`] = `
Object {
"broken.js": "\`Broken===",
"one.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
"two.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should emit an error on a broken code in parallel mode: errors 1`] = `
Array [
"Error: broken.js from Terser
Unterminated template [broken.js:1,0]",
]
`;
exports[`TerserPlugin should emit an error on a broken code in parallel mode: warnings 1`] = `Array []`;
exports[`TerserPlugin should regenerate hash: assets 1`] = `
Object {
"598.598.bf52131cff843502dc03.js": "(window.webpackJsonpterser_webpack_plugin=window.webpackJsonpterser_webpack_plugin||[]).push([[598],{598:(e,p,s)=>{\\"use strict\\";s.r(p),s.d(p,{default:()=>n});const n=\\"async-dep\\"}}]);",
"AsyncImportExport.a399f51c7fa9e85726e2.js": "(()=>{\\"use strict\\";var e,r={},t={};function o(e){if(t[e])return t[e].exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((r,t)=>(o.f[t](e,r),r),[])),o.u=e=>e+\\".\\"+e+\\".bf52131cff843502dc03.js\\",o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},o.l=(r,t,n)=>{if(e[r])e[r].push(t);else{var a,i;if(void 0!==n)for(var u=document.getElementsByTagName(\\"script\\"),l=0;l<u.length;l++){var p=u[l];if(p.getAttribute(\\"src\\")==r||p.getAttribute(\\"data-webpack\\")==\\"terser-webpack-plugin:\\"+n){a=p;break}}a||(i=!0,(a=document.createElement(\\"script\\")).charset=\\"utf-8\\",a.timeout=120,o.nc&&a.setAttribute(\\"nonce\\",o.nc),a.setAttribute(\\"data-webpack\\",\\"terser-webpack-plugin:\\"+n),a.src=r),e[r]=[t];var s=(t,o)=>{a.onerror=a.onload=null,clearTimeout(d);var n=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(s.bind(null,void 0,{type:\\"timeout\\",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),i&&document.head.appendChild(a)}},o.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},o.p=\\"\\",(()=>{var e={988:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((t,o)=>{n=e[r]=[t,o]});t.push(n[2]=a);var i=o.p+o.u(r),u=new Error;o.l(i,t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&(\\"load\\"===t.type?\\"missing\\":t.type),i=t&&t.target&&t.target.src;u.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",u.name=\\"ChunkLoadError\\",u.type=a,u.request=i,n[1](u)}},\\"chunk-\\"+r)}};var r=window.webpackJsonpterser_webpack_plugin=window.webpackJsonpterser_webpack_plugin||[],t=r.push.bind(r);r.push=function(r){for(var t,a,i=r[0],u=r[1],l=r[3],p=0,s=[];p<i.length;p++)a=i[p],o.o(e,a)&&e[a]&&s.push(e[a][0]),e[a]=0;for(t in u)o.o(u,t)&&(o.m[t]=u[t]);for(l&&l(o),n&&n(r);s.length;)s.shift()()};var n=t})(),o.e(598).then(o.bind(o,598)).then(()=>{console.log(\\"Good\\")})})();",
"importExport.ef3cbce40c35578b96ab.js": "(()=>{\\"use strict\\"})();",
"js.38170a7c37dc6835a538.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
"mjs.03cc3c61ed86051ac7c9.js": "(()=>{var r={631:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(631)})();",
}
`;
exports[`TerserPlugin should regenerate hash: errors 1`] = `Array []`;
exports[`TerserPlugin should regenerate hash: warnings 1`] = `Array []`;
exports[`TerserPlugin should respect hash options #2: assets 1`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should respect hash options #2: errors 1`] = `Array []`;
exports[`TerserPlugin should respect hash options #2: warnings 1`] = `Array []`;
exports[`TerserPlugin should respect the hash options #1: assets 1`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should respect the hash options #1: errors 1`] = `Array []`;
exports[`TerserPlugin should respect the hash options #1: warnings 1`] = `Array []`;
exports[`TerserPlugin should work (without options): assets 1`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work (without options): errors 1`] = `Array []`;
exports[`TerserPlugin should work (without options): warnings 1`] = `Array []`;
exports[`TerserPlugin should work and respect "terser" errors (the "parallel" option is "false"): errors 1`] = `
Array [
"Error: main.js from Terser
Unexpected token name «Object», expected punc «,» [main.js:1,8]",
]
`;
exports[`TerserPlugin should work and respect "terser" errors (the "parallel" option is "false"): warnings 1`] = `Array []`;
exports[`TerserPlugin should work and respect "terser" errors (the "parallel" option is "true"): errors 1`] = `
Array [
"Error: main.js from Terser
Unexpected token name «Object», expected punc «,» [main.js:1,8]",
]
`;
exports[`TerserPlugin should work and respect "terser" errors (the "parallel" option is "true"): warnings 1`] = `Array []`;
exports[`TerserPlugin should work and show minimized assets in stats: assets 1`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work and show minimized assets in stats: errors 1`] = `Array []`;
exports[`TerserPlugin should work and show minimized assets in stats: warnings 1`] = `Array []`;
exports[`TerserPlugin should work and show related assets in stats: assets 1`] = `
Object {
"comments.js": "/*! For license information please see comments.js.LICENSE.txt */
(()=>{var r={712:r=>{r.exports=Math.random()}},t={};!function e(o){if(t[o])return t[o].exports;var n=t[o]={exports:{}};return r[o](n,n.exports,e),n.exports}(712)})();
//# sourceMappingURL=comments.js.map",
"comments.js.LICENSE.txt": "/**
* Duplicate comment in difference files.
* @license MIT
*/
",
"comments.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/comments-4.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"Math\\",\\"random\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\";qBAKAA,EAAOC,QAAUC,KAAKC,WCJlBC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUL,QAG3C,IAAID,EAASI,EAAyBE,GAAY,CAGjDL,QAAS,IAOV,OAHAM,EAAoBD,GAAUN,EAAQA,EAAOC,QAASI,GAG/CL,EAAOC,QCjBfI,CAAoB,M\\",\\"file\\":\\"comments.js\\",\\"sourcesContent\\":[\\"/**\\\\n * Duplicate comment in difference files.\\\\n * @license MIT\\\\n */\\\\n\\\\nmodule.exports = Math.random();\\\\n\\",\\"// The module cache\\\\nvar __webpack_module_cache__ = {};\\\\n\\\\n// The require function\\\\nfunction __webpack_require__(moduleId) {\\\\n\\\\t// Check if module is in cache\\\\n\\\\tif(__webpack_module_cache__[moduleId]) {\\\\n\\\\t\\\\treturn __webpack_module_cache__[moduleId].exports;\\\\n\\\\t}\\\\n\\\\t// Create a new module (and put it into the cache)\\\\n\\\\tvar module = __webpack_module_cache__[moduleId] = {\\\\n\\\\t\\\\t// no module.id needed\\\\n\\\\t\\\\t// no module.loaded needed\\\\n\\\\t\\\\texports: {}\\\\n\\\\t};\\\\n\\\\n\\\\t// Execute the module function\\\\n\\\\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\\\\n\\\\n\\\\t// Return the exports of the module\\\\n\\\\treturn module.exports;\\\\n}\\\\n\\\\n\\",\\"// startup\\\\n// Load entry module\\\\n// This entry module is referenced by other modules so it can't be inlined\\\\n__webpack_require__(712);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
}
`;
exports[`TerserPlugin should work and show related assets in stats: errors 1`] = `Array []`;
exports[`TerserPlugin should work and show related assets in stats: warnings 1`] = `Array []`;
exports[`TerserPlugin should work as a minimizer: assets 1`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work as a minimizer: errors 1`] = `Array []`;
exports[`TerserPlugin should work as a minimizer: warnings 1`] = `Array []`;
exports[`TerserPlugin should work as a plugin: assets 1`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work as a plugin: errors 1`] = `Array []`;
exports[`TerserPlugin should work as a plugin: warnings 1`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: assets 1`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: assets 2`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: assets 3`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: assets 4`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: assets 5`] = `
Object {
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: errors 1`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: errors 2`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: errors 3`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: errors 4`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: errors 5`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: warnings 1`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: warnings 2`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: warnings 3`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: warnings 4`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin and with the same file: warnings 5`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: assets 1`] = `
Object {
"main-1.js": "/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 791:
/***/ ((module) => {
// foo
/* @preserve*/
// bar
const a = 2 + 2;
module.exports = function Foo() {
const b = 2 + 2;
console.log(b + 1 + 2);
};
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ // startup
/******/ // Load entry module
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ __webpack_require__(791);
/******/ })()
;",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: assets 2`] = `
Object {
"main-2.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: assets 3`] = `
Object {
"main-3.js": "(()=>{\\"use strict\\"})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: compiler plugin count 1`] = `
Object {
"additionalPass": 0,
"afterCompile": 0,
"afterDone": 0,
"afterEmit": 1,
"afterEnvironment": 0,
"afterPlugins": 0,
"afterResolvers": 0,
"assetEmitted": 0,
"beforeCompile": 0,
"beforeRun": 1,
"compilation": 51,
"compile": 0,
"contextModuleFactory": 0,
"done": 1,
"emit": 0,
"entryOption": 1,
"environment": 0,
"failed": 0,
"finishMake": 0,
"infrastructureLog": 0,
"initialize": 0,
"invalid": 1,
"make": 1,
"normalModuleFactory": 1,
"run": 0,
"shouldEmit": 1,
"thisCompilation": 5,
"watchClose": 0,
"watchRun": 0,
}
`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: errors 1`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: errors 2`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: errors 3`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: warnings 1`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: warnings 2`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode with the one plugin: warnings 3`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode: assets 1`] = `
Object {
"main-1.js": "/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 791:
/***/ ((module) => {
// foo
/* @preserve*/
// bar
const a = 2 + 2;
module.exports = function Foo() {
const b = 2 + 2;
console.log(b + 1 + 2);
};
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ // startup
/******/ // Load entry module
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ __webpack_require__(791);
/******/ })()
;",
}
`;
exports[`TerserPlugin should work in multi compiler mode: assets 2`] = `
Object {
"main-2.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode: assets 3`] = `
Object {
"main-3.js": "(()=>{\\"use strict\\"})();",
}
`;
exports[`TerserPlugin should work in multi compiler mode: compiler plugin count 1`] = `
Object {
"additionalPass": 0,
"afterCompile": 0,
"afterDone": 0,
"afterEmit": 1,
"afterEnvironment": 0,
"afterPlugins": 0,
"afterResolvers": 0,
"assetEmitted": 0,
"beforeCompile": 0,
"beforeRun": 1,
"compilation": 51,
"compile": 0,
"contextModuleFactory": 0,
"done": 1,
"emit": 0,
"entryOption": 1,
"environment": 0,
"failed": 0,
"finishMake": 0,
"infrastructureLog": 0,
"initialize": 0,
"invalid": 1,
"make": 1,
"normalModuleFactory": 1,
"run": 0,
"shouldEmit": 1,
"thisCompilation": 5,
"watchClose": 0,
"watchRun": 0,
}
`;
exports[`TerserPlugin should work in multi compiler mode: errors 1`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode: errors 2`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode: errors 3`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode: warnings 1`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode: warnings 2`] = `Array []`;
exports[`TerserPlugin should work in multi compiler mode: warnings 3`] = `Array []`;
exports[`TerserPlugin should work when some of assets do not contain source maps: assets 1`] = `
Object {
"extra-file.js": "var a=1;console.log(a);",
"main.js": "(()=>{var r={336:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(336)})();
//# sourceMappingURL=main.js.map",
"main.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/entry.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"console\\",\\"log\\",\\"b\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\"qBAKAA,EAAOC,QAAU,WAEfC,QAAQC,IAAIC,MCNVC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUN,QAG3C,IAAID,EAASK,EAAyBE,GAAY,CAGjDN,QAAS,IAOV,OAHAO,EAAoBD,GAAUP,EAAQA,EAAOC,QAASK,GAG/CN,EAAOC,QCjBfK,CAAoB,M\\",\\"file\\":\\"main.js\\",\\"sourcesContent\\":[\\"// foo\\\\n/* @preserve*/\\\\n// bar\\\\nconst a = 2 + 2;\\\\n\\\\nmodule.exports = function Foo() {\\\\n const b = 2 + 2;\\\\n console.log(b + 1 + 2);\\\\n};\\\\n\\",\\"// The module cache\\\\nvar __webpack_module_cache__ = {};\\\\n\\\\n// The require function\\\\nfunction __webpack_require__(moduleId) {\\\\n\\\\t// Check if module is in cache\\\\n\\\\tif(__webpack_module_cache__[moduleId]) {\\\\n\\\\t\\\\treturn __webpack_module_cache__[moduleId].exports;\\\\n\\\\t}\\\\n\\\\t// Create a new module (and put it into the cache)\\\\n\\\\tvar module = __webpack_module_cache__[moduleId] = {\\\\n\\\\t\\\\t// no module.id needed\\\\n\\\\t\\\\t// no module.loaded needed\\\\n\\\\t\\\\texports: {}\\\\n\\\\t};\\\\n\\\\n\\\\t// Execute the module function\\\\n\\\\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\\\\n\\\\n\\\\t// Return the exports of the module\\\\n\\\\treturn module.exports;\\\\n}\\\\n\\\\n\\",\\"// startup\\\\n// Load entry module\\\\n// This entry module is referenced by other modules so it can't be inlined\\\\n__webpack_require__(336);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
}
`;
exports[`TerserPlugin should work when some of assets do not contain source maps: errors 1`] = `Array []`;
exports[`TerserPlugin should work when some of assets do not contain source maps: warnings 1`] = `Array []`;
exports[`TerserPlugin should work with "asset" module type: assets 1`] = `
Object {
"emitted.js": "console.log(\\"HERE\\");",
"main.js": "(()=>{\\"use strict\\";var r,t={484:(r,t,e)=>{r.exports=e.p+\\"emitted.js\\"}},e={};function o(r){if(e[r])return e[r].exports;var s=e[r]={exports:{}};return t[r](s,s.exports,o),s.exports}o.p=\\"\\",r=o(484),console.log(12,r)})();",
}
`;
exports[`TerserPlugin should work with "asset" module type: errors 1`] = `Array []`;
exports[`TerserPlugin should work with "asset" module type: warnings 1`] = `Array []`;
exports[`TerserPlugin should work with "copy-webpack-plugin": assets 1`] = `
Object {
"copy.js": "var foo=12;console.log(foo);",
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;
exports[`TerserPlugin should work with "copy-webpack-plugin": errors 1`] = `Array []`;
exports[`TerserPlugin should work with "copy-webpack-plugin": warnings 1`] = `Array []`;
exports[`TerserPlugin should work with "file-loader": assets 1`] = `
Object {
"main.js": "(()=>{\\"use strict\\";var t={p:\\"\\"};const s=t.p+\\"test/fixtures/emitted.js\\";console.log(12,s)})();",
"test/fixtures/emitted.js": "console.log(\\"HERE\\");",
}
`;
exports[`TerserPlugin should work with "file-loader": errors 1`] = `Array []`;
exports[`TerserPlugin should work with "file-loader": warnings 1`] = `Array []`;
exports[`TerserPlugin should work with child compilation: assets 1`] = `
Object {
"file.worker.worker.js": "/*! For license information please see file.worker.worker.js.LICENSE.txt */
onmessage=function(n){};",
"file.worker.worker.js.LICENSE.txt": "/*! Legal Comment 1 */
/*! Legal Comment 2 */
/*! Legal Comment 3 */
",
"main.js": "/*! For license information please see main.js.LICENSE.txt */
(()=>{\\"use strict\\";var e={};e.p=\\"\\";const n=new function(){return new Worker(e.p+\\"file.worker.worker.js\\")};n.postMessage({a:1}),n.onmessage=function(e){},n.addEventListener(\\"message\\",(function(e){}))})();",
"main.js.LICENSE.txt": "/*! Legal Comment */
",
}
`;
exports[`TerserPlugin should work with child compilation: errors 1`] = `Array []`;
exports[`TerserPlugin should work with child compilation: warnings 1`] = `Array []`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in not parallel mode: assets 1`] = `
Object {
"one.js": "",
"two.js": "",
}
`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in not parallel mode: errors 1`] = `Array []`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in not parallel mode: process stderr output 1`] = `
"stderr
stderr
"
`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in not parallel mode: process stdout output 1`] = `
"stdout
stdout
"
`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in not parallel mode: warnings 1`] = `Array []`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in parallel mode: assets 1`] = `
Object {
"one.js": "",
"two.js": "",
}
`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in parallel mode: errors 1`] = `Array []`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in parallel mode: process stderr output 1`] = `
"stderr
stderr
"
`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in parallel mode: process stdout output 1`] = `
"stdout
stdout
"
`;
exports[`TerserPlugin should write stdout and stderr of workers to stdout and stderr of main process in parallel mode: warnings 1`] = `Array []`;