/
TerserPlugin.test.js.snap.webpack5
343 lines (278 loc) · 13.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
// 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 buildSourceMap method 1`] = `
SourceMapConsumer {
"_absoluteSources": Array [
"http://example.com/www/js/one.js",
"http://example.com/www/js/two.js",
],
"_mappings": "CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA",
"_names": ArraySet {
"_array": Array [
"bar",
"baz",
"n",
],
"_set": Map {
"bar" => 0,
"baz" => 1,
"n" => 2,
},
},
"_sourceMapURL": undefined,
"_sources": ArraySet {
"_array": Array [
"one.js",
"two.js",
],
"_set": Map {
"one.js" => 0,
"two.js" => 1,
},
},
"file": "test.js",
"sourceRoot": "http://example.com/www/js/",
"sourcesContent": null,
}
`;
exports[`TerserPlugin buildWarning method 1`] = `"Terser Plugin: Warning [test.js:1,1]"`;
exports[`TerserPlugin buildWarning method 2`] = `"Terser Plugin: Warning [test.js:1,1]"`;
exports[`TerserPlugin buildWarning method 3`] = `"Terser Plugin: Warning [test.js:1,1]"`;
exports[`TerserPlugin buildWarning method 4`] = `"Terser Plugin: Warning [http://example.com/www/js/one.js:1,1]"`;
exports[`TerserPlugin buildWarning method 5`] = `"Terser Plugin: Warning [http://example.com/www/js/one.js:1,1]"`;
exports[`TerserPlugin buildWarning method 6`] = `null`;
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.231e24cc7ba6b0dd72f5.js": "(window.webpackJsonp=window.webpackJsonp||[]).push([[598],{598:(s,n,p)=>{\\"use strict\\";p.r(n),p.d(n,{default:()=>w});const w=\\"async-dep\\"}}]);",
"AsyncImportExport.2ae3fb5e1948976097cc.js": "(()=>{\\"use strict\\";var e={},r={};function o(t){if(r[t])return r[t].exports;var n=r[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.m=e,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+\\".231e24cc7ba6b0dd72f5.js\\",o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),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((o,t)=>{n=e[r]=[o,t]});t.push(n[2]=a);var i,s=o.p+o.u(r),u=document.createElement(\\"script\\");u.charset=\\"utf-8\\",u.timeout=120,o.nc&&u.setAttribute(\\"nonce\\",o.nc),u.src=s;var d=new Error;i=t=>{i=()=>{},u.onerror=u.onload=null,clearTimeout(p);var a=(()=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n))return n[1]})();if(a){var s=t&&(\\"load\\"===t.type?\\"missing\\":t.type),c=t&&t.target&&t.target.src;d.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+s+\\": \\"+c+\\")\\",d.name=\\"ChunkLoadError\\",d.type=s,d.request=c,a(d)}};var p=setTimeout(()=>{i({type:\\"timeout\\",target:u})},12e4);u.onerror=u.onload=i,document.head.appendChild(u)}};var r=window.webpackJsonp=window.webpackJsonp||[],t=r.push.bind(r);r.push=function(r){for(var t,a,i=r[0],s=r[1],u=r[3],d=0,p=[];d<i.length;d++)a=i[d],o.o(e,a)&&e[a]&&p.push(e[a][0]),e[a]=0;for(t in s)o.o(s,t)&&(o.m[t]=s[t]);for(u&&u(o),n&&n(r);p.length;)p.shift()()};var n=t})(),o.e(598).then(o.bind(o,598)).then(()=>{console.log(\\"Good\\")})})();",
"importExport.0dbc63908665d493ffa4.js": "(()=>{\\"use strict\\"})();",
"js.370572a7b0287c3b0be4.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.150cef491f73b14e764c.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 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: 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": 47,
"compile": 0,
"contextModuleFactory": 0,
"done": 1,
"emit": 0,
"entryOption": 1,
"environment": 0,
"failed": 0,
"infrastructureLog": 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 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 []`;