Skip to content

Commit 0e21d92

Browse files
authoredSep 15, 2020
test: cache (#316)
1 parent 5de108d commit 0e21d92

File tree

3 files changed

+537
-8
lines changed

3 files changed

+537
-8
lines changed
 

‎test/__snapshots__/cache-option.test.js.snap.webpack4

+6-6
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ exports[`"cache" option should match snapshot for the "true" value and extract c
192192

193193
exports[`"cache" option should match snapshot for the "true" value and extract comments in different files: warnings 2`] = `Array []`;
194194

195-
exports[`"cache" option should match snapshot for the "true" value and extract comments in one files: assets 1`] = `
195+
exports[`"cache" option should match snapshot for the "true" value and extract comments in the one file: assets 1`] = `
196196
Object {
197197
"4.4.js": "/*! For license information please see licenses.txt */
198198
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{4:function(n,o){n.exports=Math.random()}}]);",
@@ -245,7 +245,7 @@ Object {
245245
}
246246
`;
247247

248-
exports[`"cache" option should match snapshot for the "true" value and extract comments in one files: assets 2`] = `
248+
exports[`"cache" option should match snapshot for the "true" value and extract comments in the one file: assets 2`] = `
249249
Object {
250250
"4.4.js": "/*! For license information please see licenses.txt */
251251
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{4:function(n,o){n.exports=Math.random()}}]);",
@@ -298,13 +298,13 @@ Object {
298298
}
299299
`;
300300

301-
exports[`"cache" option should match snapshot for the "true" value and extract comments in one files: errors 1`] = `Array []`;
301+
exports[`"cache" option should match snapshot for the "true" value and extract comments in the one file: errors 1`] = `Array []`;
302302

303-
exports[`"cache" option should match snapshot for the "true" value and extract comments in one files: errors 2`] = `Array []`;
303+
exports[`"cache" option should match snapshot for the "true" value and extract comments in the one file: errors 2`] = `Array []`;
304304

305-
exports[`"cache" option should match snapshot for the "true" value and extract comments in one files: warnings 1`] = `Array []`;
305+
exports[`"cache" option should match snapshot for the "true" value and extract comments in the one file: warnings 1`] = `Array []`;
306306

307-
exports[`"cache" option should match snapshot for the "true" value and extract comments in one files: warnings 2`] = `Array []`;
307+
exports[`"cache" option should match snapshot for the "true" value and extract comments in the one file: warnings 2`] = `Array []`;
308308

309309
exports[`"cache" option should match snapshot for the "true" value and source maps: assets 1`] = `
310310
Object {

‎test/__snapshots__/cache-option.test.js.snap.webpack5

+284
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,290 @@ exports[`"cache" option should work with "false" value for the "cache" option: w
2828

2929
exports[`"cache" option should work with "false" value for the "cache" option: warnings 2`] = `Array []`;
3030

31+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in different files: assets 1`] = `
32+
Object {
33+
"627.627.js": "/*! For license information please see 627.627.js.LICENSE.txt */
34+
(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[627],{627:e=>{e.exports=Math.random()}}]);",
35+
"627.627.js.LICENSE.txt": "/*! Legal Comment */
36+
37+
/** @license Copyright 2112 Moon. **/
38+
",
39+
"four.js": "/*! For license information please see four.js.LICENSE.txt */
40+
(()=>{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)})();",
41+
"four.js.LICENSE.txt": "/**
42+
* Duplicate comment in difference files.
43+
* @license MIT
44+
*/
45+
",
46+
"one.js": "/*! For license information please see one.js.LICENSE.txt */
47+
(()=>{var e,r,t={900:(e,r,t)=>{t.e(627).then(t.t.bind(t,627,7)),e.exports=Math.random()}},o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,n.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if(4&r&&\\"object\\"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);n.r(t);var o={};if(2&r&&\\"object\\"==typeof e&&e)for(const r in e)o[r]=()=>e[r];return o.default=()=>e,n.d(t,o),t},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+\\".\\"+e+\\".js\\",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a)=>{if(e[t])e[t].push(o);else{var i,u;if(void 0!==a)for(var l=document.getElementsByTagName(\\"script\\"),s=0;s<l.length;s++){var p=l[s];if(p.getAttribute(\\"src\\")==t||p.getAttribute(\\"data-webpack\\")==r+a){i=p;break}}i||(u=!0,(i=document.createElement(\\"script\\")).charset=\\"utf-8\\",i.timeout=120,n.nc&&i.setAttribute(\\"nonce\\",n.nc),i.setAttribute(\\"data-webpack\\",r+a),i.src=t),e[t]=[o];var d=(r,o)=>{i.onerror=i.onload=null,clearTimeout(c);var n=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(e=>e(o)),r)return r(o)},c=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},n.p=\\"\\",(()=>{var e={255:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,n)=>{o=e[r]=[t,n]});t.push(o[2]=a);var i=n.p+n.u(r),u=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){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,o[1](u)}},\\"chunk-\\"+r)}};var r=self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[],t=r.push.bind(r);r.push=r=>{for(var o,a,[i,u,l]=r,s=0,p=[];s<i.length;s++)a=i[s],n.o(e,a)&&e[a]&&p.push(e[a][0]),e[a]=0;for(o in u)n.o(u,o)&&(n.m[o]=u[o]);for(l&&l(n),t(r);p.length;)p.shift()()}})(),n(900)})();",
48+
"one.js.LICENSE.txt": "/*! Legal Comment */
49+
50+
/*! Legal Foo */
51+
52+
/**
53+
* @preserve Copyright 2009 SomeThirdParty.
54+
* Here is the full license text and copyright
55+
* notice for this file. Note that the notice can span several
56+
* lines and is only terminated by the closing star and slash:
57+
*/
58+
59+
/**
60+
* Utility functions for the foo package.
61+
* @license Apache-2.0
62+
*/
63+
64+
// @lic
65+
",
66+
"three.js": "/*! For license information please see three.js.LICENSE.txt */
67+
(()=>{var r={787: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}(787)})();",
68+
"three.js.LICENSE.txt": "/**
69+
* Duplicate comment in difference files.
70+
* @license MIT
71+
*/
72+
73+
/**
74+
* Duplicate comment in same file.
75+
* @license MIT
76+
*/
77+
",
78+
"two.js": "/*! For license information please see two.js.LICENSE.txt */
79+
(()=>{var r={353: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}(353)})();",
80+
"two.js.LICENSE.txt": "/**
81+
* Information.
82+
* @license MIT
83+
*/
84+
",
85+
}
86+
`;
87+
88+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in different files: assets 2`] = `
89+
Object {
90+
"627.627.js": "/*! For license information please see 627.627.js.LICENSE.txt */
91+
(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[627],{627:e=>{e.exports=Math.random()}}]);",
92+
"627.627.js.LICENSE.txt": "/*! Legal Comment */
93+
94+
/** @license Copyright 2112 Moon. **/
95+
",
96+
"four.js": "/*! For license information please see four.js.LICENSE.txt */
97+
(()=>{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)})();",
98+
"four.js.LICENSE.txt": "/**
99+
* Duplicate comment in difference files.
100+
* @license MIT
101+
*/
102+
",
103+
"one.js": "/*! For license information please see one.js.LICENSE.txt */
104+
(()=>{var e,r,t={900:(e,r,t)=>{t.e(627).then(t.t.bind(t,627,7)),e.exports=Math.random()}},o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,n.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if(4&r&&\\"object\\"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);n.r(t);var o={};if(2&r&&\\"object\\"==typeof e&&e)for(const r in e)o[r]=()=>e[r];return o.default=()=>e,n.d(t,o),t},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+\\".\\"+e+\\".js\\",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a)=>{if(e[t])e[t].push(o);else{var i,u;if(void 0!==a)for(var l=document.getElementsByTagName(\\"script\\"),s=0;s<l.length;s++){var p=l[s];if(p.getAttribute(\\"src\\")==t||p.getAttribute(\\"data-webpack\\")==r+a){i=p;break}}i||(u=!0,(i=document.createElement(\\"script\\")).charset=\\"utf-8\\",i.timeout=120,n.nc&&i.setAttribute(\\"nonce\\",n.nc),i.setAttribute(\\"data-webpack\\",r+a),i.src=t),e[t]=[o];var d=(r,o)=>{i.onerror=i.onload=null,clearTimeout(c);var n=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(e=>e(o)),r)return r(o)},c=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},n.p=\\"\\",(()=>{var e={255:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,n)=>{o=e[r]=[t,n]});t.push(o[2]=a);var i=n.p+n.u(r),u=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){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,o[1](u)}},\\"chunk-\\"+r)}};var r=self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[],t=r.push.bind(r);r.push=r=>{for(var o,a,[i,u,l]=r,s=0,p=[];s<i.length;s++)a=i[s],n.o(e,a)&&e[a]&&p.push(e[a][0]),e[a]=0;for(o in u)n.o(u,o)&&(n.m[o]=u[o]);for(l&&l(n),t(r);p.length;)p.shift()()}})(),n(900)})();",
105+
"one.js.LICENSE.txt": "/*! Legal Comment */
106+
107+
/*! Legal Foo */
108+
109+
/**
110+
* @preserve Copyright 2009 SomeThirdParty.
111+
* Here is the full license text and copyright
112+
* notice for this file. Note that the notice can span several
113+
* lines and is only terminated by the closing star and slash:
114+
*/
115+
116+
/**
117+
* Utility functions for the foo package.
118+
* @license Apache-2.0
119+
*/
120+
121+
// @lic
122+
",
123+
"three.js": "/*! For license information please see three.js.LICENSE.txt */
124+
(()=>{var r={787: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}(787)})();",
125+
"three.js.LICENSE.txt": "/**
126+
* Duplicate comment in difference files.
127+
* @license MIT
128+
*/
129+
130+
/**
131+
* Duplicate comment in same file.
132+
* @license MIT
133+
*/
134+
",
135+
"two.js": "/*! For license information please see two.js.LICENSE.txt */
136+
(()=>{var r={353: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}(353)})();",
137+
"two.js.LICENSE.txt": "/**
138+
* Information.
139+
* @license MIT
140+
*/
141+
",
142+
}
143+
`;
144+
145+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in different files: errors 1`] = `Array []`;
146+
147+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in different files: errors 2`] = `Array []`;
148+
149+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in different files: warnings 1`] = `Array []`;
150+
151+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in different files: warnings 2`] = `Array []`;
152+
153+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in the one file: assets 1`] = `
154+
Object {
155+
"627.627.js": "/*! For license information please see licenses.txt */
156+
(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[627],{627:e=>{e.exports=Math.random()}}]);",
157+
"four.js": "/*! For license information please see licenses.txt */
158+
(()=>{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)})();",
159+
"licenses.txt": "/*! Legal Comment */
160+
161+
/** @license Copyright 2112 Moon. **/
162+
163+
164+
/**
165+
* Duplicate comment in difference files.
166+
* @license MIT
167+
*/
168+
169+
170+
/*! Legal Foo */
171+
172+
/**
173+
* @preserve Copyright 2009 SomeThirdParty.
174+
* Here is the full license text and copyright
175+
* notice for this file. Note that the notice can span several
176+
* lines and is only terminated by the closing star and slash:
177+
*/
178+
179+
/**
180+
* Utility functions for the foo package.
181+
* @license Apache-2.0
182+
*/
183+
184+
// @lic
185+
186+
/**
187+
* Duplicate comment in same file.
188+
* @license MIT
189+
*/
190+
191+
192+
/**
193+
* Information.
194+
* @license MIT
195+
*/
196+
",
197+
"one.js": "/*! For license information please see licenses.txt */
198+
(()=>{var e,r,t={900:(e,r,t)=>{t.e(627).then(t.t.bind(t,627,7)),e.exports=Math.random()}},o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,n.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if(4&r&&\\"object\\"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);n.r(t);var o={};if(2&r&&\\"object\\"==typeof e&&e)for(const r in e)o[r]=()=>e[r];return o.default=()=>e,n.d(t,o),t},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+\\".\\"+e+\\".js\\",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a)=>{if(e[t])e[t].push(o);else{var i,u;if(void 0!==a)for(var l=document.getElementsByTagName(\\"script\\"),s=0;s<l.length;s++){var p=l[s];if(p.getAttribute(\\"src\\")==t||p.getAttribute(\\"data-webpack\\")==r+a){i=p;break}}i||(u=!0,(i=document.createElement(\\"script\\")).charset=\\"utf-8\\",i.timeout=120,n.nc&&i.setAttribute(\\"nonce\\",n.nc),i.setAttribute(\\"data-webpack\\",r+a),i.src=t),e[t]=[o];var d=(r,o)=>{i.onerror=i.onload=null,clearTimeout(c);var n=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(e=>e(o)),r)return r(o)},c=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},n.p=\\"\\",(()=>{var e={255:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,n)=>{o=e[r]=[t,n]});t.push(o[2]=a);var i=n.p+n.u(r),u=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){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,o[1](u)}},\\"chunk-\\"+r)}};var r=self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[],t=r.push.bind(r);r.push=r=>{for(var o,a,[i,u,l]=r,s=0,p=[];s<i.length;s++)a=i[s],n.o(e,a)&&e[a]&&p.push(e[a][0]),e[a]=0;for(o in u)n.o(u,o)&&(n.m[o]=u[o]);for(l&&l(n),t(r);p.length;)p.shift()()}})(),n(900)})();",
199+
"three.js": "/*! For license information please see licenses.txt */
200+
(()=>{var r={787: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}(787)})();",
201+
"two.js": "/*! For license information please see licenses.txt */
202+
(()=>{var r={353: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}(353)})();",
203+
}
204+
`;
205+
206+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in the one file: assets 2`] = `
207+
Object {
208+
"627.627.js": "/*! For license information please see licenses.txt */
209+
(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[627],{627:e=>{e.exports=Math.random()}}]);",
210+
"four.js": "/*! For license information please see licenses.txt */
211+
(()=>{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)})();",
212+
"licenses.txt": "/*! Legal Comment */
213+
214+
/** @license Copyright 2112 Moon. **/
215+
216+
217+
/**
218+
* Duplicate comment in difference files.
219+
* @license MIT
220+
*/
221+
222+
223+
/*! Legal Foo */
224+
225+
/**
226+
* @preserve Copyright 2009 SomeThirdParty.
227+
* Here is the full license text and copyright
228+
* notice for this file. Note that the notice can span several
229+
* lines and is only terminated by the closing star and slash:
230+
*/
231+
232+
/**
233+
* Utility functions for the foo package.
234+
* @license Apache-2.0
235+
*/
236+
237+
// @lic
238+
239+
/**
240+
* Duplicate comment in same file.
241+
* @license MIT
242+
*/
243+
244+
245+
/**
246+
* Information.
247+
* @license MIT
248+
*/
249+
",
250+
"one.js": "/*! For license information please see licenses.txt */
251+
(()=>{var e,r,t={900:(e,r,t)=>{t.e(627).then(t.t.bind(t,627,7)),e.exports=Math.random()}},o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,n.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if(4&r&&\\"object\\"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);n.r(t);var o={};if(2&r&&\\"object\\"==typeof e&&e)for(const r in e)o[r]=()=>e[r];return o.default=()=>e,n.d(t,o),t},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+\\".\\"+e+\\".js\\",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a)=>{if(e[t])e[t].push(o);else{var i,u;if(void 0!==a)for(var l=document.getElementsByTagName(\\"script\\"),s=0;s<l.length;s++){var p=l[s];if(p.getAttribute(\\"src\\")==t||p.getAttribute(\\"data-webpack\\")==r+a){i=p;break}}i||(u=!0,(i=document.createElement(\\"script\\")).charset=\\"utf-8\\",i.timeout=120,n.nc&&i.setAttribute(\\"nonce\\",n.nc),i.setAttribute(\\"data-webpack\\",r+a),i.src=t),e[t]=[o];var d=(r,o)=>{i.onerror=i.onload=null,clearTimeout(c);var n=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(e=>e(o)),r)return r(o)},c=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},n.p=\\"\\",(()=>{var e={255:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,n)=>{o=e[r]=[t,n]});t.push(o[2]=a);var i=n.p+n.u(r),u=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){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,o[1](u)}},\\"chunk-\\"+r)}};var r=self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[],t=r.push.bind(r);r.push=r=>{for(var o,a,[i,u,l]=r,s=0,p=[];s<i.length;s++)a=i[s],n.o(e,a)&&e[a]&&p.push(e[a][0]),e[a]=0;for(o in u)n.o(u,o)&&(n.m[o]=u[o]);for(l&&l(n),t(r);p.length;)p.shift()()}})(),n(900)})();",
252+
"three.js": "/*! For license information please see licenses.txt */
253+
(()=>{var r={787: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}(787)})();",
254+
"two.js": "/*! For license information please see licenses.txt */
255+
(()=>{var r={353: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}(353)})();",
256+
}
257+
`;
258+
259+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in the one file: errors 1`] = `Array []`;
260+
261+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in the one file: errors 2`] = `Array []`;
262+
263+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in the one file: warnings 1`] = `Array []`;
264+
265+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and extract comments in the one file: warnings 2`] = `Array []`;
266+
267+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and source maps: assets 1`] = `
268+
Object {
269+
"five.js": "(()=>{var r={798: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}(798)})();
270+
//# sourceMappingURL=five.js.map",
271+
"five.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-4.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\\":\\"five.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__(798);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
272+
"four.js": "(()=>{var r={26:r=>{r.exports=class{}}},t={};!function e(s){if(t[s])return t[s].exports;var o=t[s]={exports:{}};return r[s](o,o.exports,e),o.exports}(26)})();
273+
//# sourceMappingURL=four.js.map",
274+
"four.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-3.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\"oBAAAA,EAAOC,QAAU,UCCbC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUH,QAG3C,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,IAOV,OAHAI,EAAoBD,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,QCjBfE,CAAoB,K\\",\\"file\\":\\"four.js\\",\\"sourcesContent\\":[\\"module.exports = class A {};\\\\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__(26);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
275+
"one.js": "(()=>{var r={73: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}(73)})();
276+
//# sourceMappingURL=one.js.map",
277+
"one.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache.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\\":\\"oBAKAA,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,K\\",\\"file\\":\\"one.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__(73);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
278+
"three.js": "(()=>{var r={800:r=>{r.exports=()=>/test/}},t={};!function e(o){if(t[o])return t[o].exports;var s=t[o]={exports:{}};return r[o](s,s.exports,e),s.exports}(800)})();
279+
//# sourceMappingURL=three.js.map",
280+
"three.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-2.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\"qBAAAA,EAAOC,QAAU,IAAe,SCC5BC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUH,QAG3C,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,IAOV,OAHAI,EAAoBD,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,QCjBfE,CAAoB,M\\",\\"file\\":\\"three.js\\",\\"sourcesContent\\":[\\"module.exports = () => { return /test/ };\\\\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__(800);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
281+
"two.js": "(()=>{var r={370:r=>{r.exports=\\"string\\"}},t={};!function e(o){if(t[o])return t[o].exports;var s=t[o]={exports:{}};return r[o](s,s.exports,e),s.exports}(370)})();
282+
//# sourceMappingURL=two.js.map",
283+
"two.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-1.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\"qBAAAA,EAAOC,QAAU,WCCbC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUH,QAG3C,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,IAOV,OAHAI,EAAoBD,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,QCjBfE,CAAoB,M\\",\\"file\\":\\"two.js\\",\\"sourcesContent\\":[\\"module.exports = 'string';\\\\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__(370);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
284+
}
285+
`;
286+
287+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and source maps: assets 2`] = `
288+
Object {
289+
"five.js": "(()=>{var r={798: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}(798)})();
290+
//# sourceMappingURL=five.js.map",
291+
"five.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-4.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\\":\\"five.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__(798);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
292+
"four.js": "(()=>{var r={26:r=>{r.exports=class{}}},t={};!function e(s){if(t[s])return t[s].exports;var o=t[s]={exports:{}};return r[s](o,o.exports,e),o.exports}(26)})();
293+
//# sourceMappingURL=four.js.map",
294+
"four.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-3.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\"oBAAAA,EAAOC,QAAU,UCCbC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUH,QAG3C,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,IAOV,OAHAI,EAAoBD,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,QCjBfE,CAAoB,K\\",\\"file\\":\\"four.js\\",\\"sourcesContent\\":[\\"module.exports = class A {};\\\\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__(26);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
295+
"one.js": "(()=>{var r={73: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}(73)})();
296+
//# sourceMappingURL=one.js.map",
297+
"one.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache.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\\":\\"oBAKAA,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,K\\",\\"file\\":\\"one.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__(73);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
298+
"three.js": "(()=>{var r={800:r=>{r.exports=()=>/test/}},t={};!function e(o){if(t[o])return t[o].exports;var s=t[o]={exports:{}};return r[o](s,s.exports,e),s.exports}(800)})();
299+
//# sourceMappingURL=three.js.map",
300+
"three.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-2.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\"qBAAAA,EAAOC,QAAU,IAAe,SCC5BC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUH,QAG3C,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,IAOV,OAHAI,EAAoBD,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,QCjBfE,CAAoB,M\\",\\"file\\":\\"three.js\\",\\"sourcesContent\\":[\\"module.exports = () => { return /test/ };\\\\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__(800);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
301+
"two.js": "(()=>{var r={370:r=>{r.exports=\\"string\\"}},t={};!function e(o){if(t[o])return t[o].exports;var s=t[o]={exports:{}};return r[o](s,s.exports,e),s.exports}(370)})();
302+
//# sourceMappingURL=two.js.map",
303+
"two.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack://terser-webpack-plugin/./test/fixtures/cache-1.js\\",\\"webpack://terser-webpack-plugin/webpack/bootstrap\\",\\"webpack://terser-webpack-plugin/webpack/startup\\"],\\"names\\":[\\"module\\",\\"exports\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"__webpack_modules__\\"],\\"mappings\\":\\"qBAAAA,EAAOC,QAAU,WCCbC,EAA2B,IAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUH,QAG3C,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,IAOV,OAHAI,EAAoBD,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,QCjBfE,CAAoB,M\\",\\"file\\":\\"two.js\\",\\"sourcesContent\\":[\\"module.exports = 'string';\\\\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__(370);\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
304+
}
305+
`;
306+
307+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and source maps: errors 1`] = `Array []`;
308+
309+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and source maps: errors 2`] = `Array []`;
310+
311+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and source maps: warnings 1`] = `Array []`;
312+
313+
exports[`"cache" option should work with "filesystem" value for the "cache.type" option and source maps: warnings 2`] = `Array []`;
314+
31315
exports[`"cache" option should work with "filesystem" value for the "cache.type" option: assets 1`] = `
32316
Object {
33317
"five.js": "(()=>{var r={798: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}(798)})();",

‎test/cache-option.test.js

+247-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ if (getCompiler.isWebpack4()) {
291291
getCacheDirectorySpy.mockRestore();
292292
});
293293

294-
it('should match snapshot for the "true" value and extract comments in one files', async () => {
294+
it('should match snapshot for the "true" value and extract comments in the one file', async () => {
295295
compiler = getCompiler({
296296
entry: {
297297
one: path.resolve(__dirname, './fixtures/comments.js'),
@@ -495,9 +495,26 @@ if (getCompiler.isWebpack4()) {
495495
__dirname,
496496
'./outputs/type-filesystem'
497497
);
498+
const fileSystemCacheDirectory1 = path.resolve(
499+
__dirname,
500+
'./outputs/type-filesystem-1'
501+
);
502+
const fileSystemCacheDirectory2 = path.resolve(
503+
__dirname,
504+
'./outputs/type-filesystem-2'
505+
);
506+
const fileSystemCacheDirectory3 = path.resolve(
507+
__dirname,
508+
'./outputs/type-filesystem-3'
509+
);
498510

499511
beforeAll(() => {
500-
return Promise.all([del(fileSystemCacheDirectory)]);
512+
return Promise.all([
513+
del(fileSystemCacheDirectory),
514+
del(fileSystemCacheDirectory1),
515+
del(fileSystemCacheDirectory2),
516+
del(fileSystemCacheDirectory3),
517+
]);
501518
});
502519

503520
it('should work with "false" value for the "cache" option', async () => {
@@ -558,6 +575,12 @@ if (getCompiler.isWebpack4()) {
558575
expect(readsAssets(compiler, newStats)).toMatchSnapshot('assets');
559576
expect(getErrors(newStats)).toMatchSnapshot('errors');
560577
expect(getWarnings(newStats)).toMatchSnapshot('warnings');
578+
579+
await new Promise((resolve) => {
580+
compiler.close(() => {
581+
resolve();
582+
});
583+
});
561584
});
562585

563586
it('should work with "memory" value for the "cache.type" option', async () => {
@@ -621,6 +644,12 @@ if (getCompiler.isWebpack4()) {
621644
expect(readsAssets(compiler, newStats)).toMatchSnapshot('assets');
622645
expect(getErrors(newStats)).toMatchSnapshot('errors');
623646
expect(getWarnings(newStats)).toMatchSnapshot('warnings');
647+
648+
await new Promise((resolve) => {
649+
compiler.close(() => {
650+
resolve();
651+
});
652+
});
624653
});
625654

626655
it('should work with "filesystem" value for the "cache.type" option', async () => {
@@ -684,6 +713,222 @@ if (getCompiler.isWebpack4()) {
684713
expect(readsAssets(compiler, newStats)).toMatchSnapshot('assets');
685714
expect(getErrors(newStats)).toMatchSnapshot('errors');
686715
expect(getWarnings(newStats)).toMatchSnapshot('warnings');
716+
717+
await new Promise((resolve) => {
718+
compiler.close(() => {
719+
resolve();
720+
});
721+
});
722+
});
723+
724+
it('should work with "filesystem" value for the "cache.type" option and source maps', async () => {
725+
const compiler = getCompiler({
726+
devtool: 'source-map',
727+
entry: {
728+
one: path.resolve(__dirname, './fixtures/cache.js'),
729+
two: path.resolve(__dirname, './fixtures/cache-1.js'),
730+
three: path.resolve(__dirname, './fixtures/cache-2.js'),
731+
four: path.resolve(__dirname, './fixtures/cache-3.js'),
732+
five: path.resolve(__dirname, './fixtures/cache-4.js'),
733+
},
734+
cache: {
735+
type: 'filesystem',
736+
cacheDirectory: fileSystemCacheDirectory1,
737+
},
738+
});
739+
740+
new TerserPlugin().apply(compiler);
741+
742+
let getCounter = 0;
743+
744+
compiler.cache.hooks.get.tap(
745+
{ name: 'TestCache', stage: -100 },
746+
(identifier) => {
747+
if (identifier.indexOf('TerserWebpackPlugin') !== -1) {
748+
getCounter += 1;
749+
}
750+
}
751+
);
752+
753+
let storeCounter = 0;
754+
755+
compiler.cache.hooks.store.tap(
756+
{ name: 'TestCache', stage: -100 },
757+
(identifier) => {
758+
if (identifier.indexOf('TerserWebpackPlugin') !== -1) {
759+
storeCounter += 1;
760+
}
761+
}
762+
);
763+
764+
const stats = await compile(compiler);
765+
766+
// Get cache for assets
767+
expect(getCounter).toBe(5);
768+
// Store cached assets
769+
expect(storeCounter).toBe(5);
770+
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
771+
expect(getErrors(stats)).toMatchSnapshot('errors');
772+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
773+
774+
getCounter = 0;
775+
storeCounter = 0;
776+
777+
const newStats = await compile(compiler);
778+
779+
// Get cache for assets
780+
expect(getCounter).toBe(5);
781+
// No need to store, we got cached assets
782+
expect(storeCounter).toBe(0);
783+
expect(readsAssets(compiler, newStats)).toMatchSnapshot('assets');
784+
expect(getErrors(newStats)).toMatchSnapshot('errors');
785+
expect(getWarnings(newStats)).toMatchSnapshot('warnings');
786+
787+
await new Promise((resolve) => {
788+
compiler.close(() => {
789+
resolve();
790+
});
791+
});
792+
});
793+
794+
it('should work with "filesystem" value for the "cache.type" option and extract comments in different files', async () => {
795+
const compiler = getCompiler({
796+
entry: {
797+
one: path.resolve(__dirname, './fixtures/comments.js'),
798+
two: path.resolve(__dirname, './fixtures/comments-2.js'),
799+
three: path.resolve(__dirname, './fixtures/comments-3.js'),
800+
four: path.resolve(__dirname, './fixtures/comments-4.js'),
801+
},
802+
cache: {
803+
type: 'filesystem',
804+
cacheDirectory: fileSystemCacheDirectory2,
805+
},
806+
});
807+
808+
new TerserPlugin().apply(compiler);
809+
810+
let getCounter = 0;
811+
812+
compiler.cache.hooks.get.tap(
813+
{ name: 'TestCache', stage: -100 },
814+
(identifier) => {
815+
if (identifier.indexOf('TerserWebpackPlugin') !== -1) {
816+
getCounter += 1;
817+
}
818+
}
819+
);
820+
821+
let storeCounter = 0;
822+
823+
compiler.cache.hooks.store.tap(
824+
{ name: 'TestCache', stage: -100 },
825+
(identifier) => {
826+
if (identifier.indexOf('TerserWebpackPlugin') !== -1) {
827+
storeCounter += 1;
828+
}
829+
}
830+
);
831+
832+
const stats = await compile(compiler);
833+
834+
// Get cache for assets
835+
expect(getCounter).toBe(5);
836+
// Store cached assets
837+
expect(storeCounter).toBe(5);
838+
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
839+
expect(getErrors(stats)).toMatchSnapshot('errors');
840+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
841+
842+
getCounter = 0;
843+
storeCounter = 0;
844+
845+
const newStats = await compile(compiler);
846+
847+
// Get cache for assets
848+
expect(getCounter).toBe(5);
849+
// No need to store, we got cached assets
850+
expect(storeCounter).toBe(0);
851+
expect(readsAssets(compiler, newStats)).toMatchSnapshot('assets');
852+
expect(getErrors(newStats)).toMatchSnapshot('errors');
853+
expect(getWarnings(newStats)).toMatchSnapshot('warnings');
854+
855+
await new Promise((resolve) => {
856+
compiler.close(() => {
857+
resolve();
858+
});
859+
});
860+
});
861+
862+
it('should work with "filesystem" value for the "cache.type" option and extract comments in the one file', async () => {
863+
const compiler = getCompiler({
864+
entry: {
865+
one: path.resolve(__dirname, './fixtures/comments.js'),
866+
two: path.resolve(__dirname, './fixtures/comments-2.js'),
867+
three: path.resolve(__dirname, './fixtures/comments-3.js'),
868+
four: path.resolve(__dirname, './fixtures/comments-4.js'),
869+
},
870+
cache: {
871+
type: 'filesystem',
872+
cacheDirectory: fileSystemCacheDirectory3,
873+
},
874+
});
875+
876+
new TerserPlugin({
877+
extractComments: {
878+
filename: 'licenses.txt',
879+
},
880+
}).apply(compiler);
881+
882+
let getCounter = 0;
883+
884+
compiler.cache.hooks.get.tap(
885+
{ name: 'TestCache', stage: -100 },
886+
(identifier) => {
887+
if (identifier.indexOf('TerserWebpackPlugin') !== -1) {
888+
getCounter += 1;
889+
}
890+
}
891+
);
892+
893+
let storeCounter = 0;
894+
895+
compiler.cache.hooks.store.tap(
896+
{ name: 'TestCache', stage: -100 },
897+
(identifier) => {
898+
if (identifier.indexOf('TerserWebpackPlugin') !== -1) {
899+
storeCounter += 1;
900+
}
901+
}
902+
);
903+
904+
const stats = await compile(compiler);
905+
906+
// Get cache for assets
907+
expect(getCounter).toBe(9);
908+
// Store cached assets
909+
expect(storeCounter).toBe(9);
910+
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
911+
expect(getErrors(stats)).toMatchSnapshot('errors');
912+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
913+
914+
getCounter = 0;
915+
storeCounter = 0;
916+
917+
const newStats = await compile(compiler);
918+
919+
// Get cache for assets
920+
expect(getCounter).toBe(9);
921+
// No need to store, we got cached assets
922+
expect(storeCounter).toBe(0);
923+
expect(readsAssets(compiler, newStats)).toMatchSnapshot('assets');
924+
expect(getErrors(newStats)).toMatchSnapshot('errors');
925+
expect(getWarnings(newStats)).toMatchSnapshot('warnings');
926+
927+
await new Promise((resolve) => {
928+
compiler.close(() => {
929+
resolve();
930+
});
931+
});
687932
});
688933
});
689934
}

0 commit comments

Comments
 (0)
Please sign in to comment.