/
TerserPlugin.test.js.snap.webpack5
243 lines (200 loc) · 9.33 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
// 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 regenerate hash: assets 1`] = `
Object {
"598.598.f269c88a2945c1fb29a1.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.20dd5a01f5bf08dbc6c1.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+\\".f269c88a2945c1fb29a1.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 p=new Error;i=t=>{i=()=>{},u.onerror=u.onload=null,clearTimeout(c);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),d=t&&t.target&&t.target.src;p.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+s+\\": \\"+d+\\")\\",p.name=\\"ChunkLoadError\\",p.type=s,p.request=d,a(p)}};var c=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],p=0,c=[];p<i.length;p++)a=i[p],o.o(e,a)&&e[a]&&c.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);c.length;)c.shift()()};var n=t})(),o.e(598).then(o.bind(o,598)).then(()=>{console.log(\\"Good\\")})})();",
"importExport.d938eb9e9df24afaa8d2.js": "(()=>{\\"use strict\\"})();",
"js.0ec4c136cd66a3cda54a.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.d62bda6aebbfc0328d92.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 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 []`;