diff --git a/README.md b/README.md index 1265c25..246ade3 100644 --- a/README.md +++ b/README.md @@ -321,7 +321,36 @@ Allows you to override the default minify function. By default plugin uses [terser](https://github.com/terser/terser) package. Useful for using and testing unpublished versions or forks. -An array of functions can also be provided to chain multiple minimizers — the output of each minimizer is fed as input to the next. When an array is used, the [`minimizerOptions`](#minimizeroptions) option may also be an array (index-paired with `minify`) or a single object that is reused for every minimizer. +An array of functions can also be provided. Each minimizer can expose a +`filter(name, info)` helper that decides whether it should run on a given +asset; the plugin dispatches each asset only to the minimizers whose `filter` +accepts it (or runs them all when no filter is set). All built-in minimizers +ship with a `filter` that matches their natural extension, so a single plugin +instance and a single worker pool can handle JS, CSS, HTML and JSON together +without juggling multiple `TerserPlugin` instances — just widen `test` to +let those asset types reach the dispatcher: + +```js +new TerserPlugin({ + test: /\.(?:[cm]?js|css|html?|json)(\?.*)?$/i, + minify: [ + TerserPlugin.terserMinify, + TerserPlugin.cssnanoMinify, + TerserPlugin.htmlMinifierTerser, + TerserPlugin.jsonMinify, + ], +}); +``` + +When more than one minimizer in the array claims the same asset, the chain +semantic still applies: the output of each accepting minimizer is fed as +input to the next. The [`minimizerOptions`](#minimizeroptions) option may +be an array (index-paired with `minify`) or a single object reused by every +minimizer. + +The `test` option always defaults to `/\.[cm]?js(\?.*)?$/i`. When you mix +asset types in a single plugin instance, widen `test` so non-JS assets reach +the dispatcher (for example `test: /\.(?:[cm]?js|css|html?|json)(\?.*)?$/i`). > **Warning** > @@ -362,6 +391,12 @@ minify.getMinimizerVersion = () => { return packageJson && packageJson.version; }; +// Restrict the minimizer to the assets it can actually handle. The plugin +// skips assets for which `filter` returns `false` and (when an array of +// minimizers is used) dispatches each asset only to the minimizers that +// accept it. Returning `undefined` is treated as accept. +minify.filter = (name) => /\.[cm]?js(\?.*)?$/i.test(name); + module.exports = { optimization: { minimize: true, @@ -379,11 +414,13 @@ module.exports = { #### `array` -If an array of functions is passed to the `minify` option, the output of each -minimizer is fed as input to the next one. The `minimizerOptions` option can be -either an array of option objects (index-paired with `minify`) or a single -object that will be shared by all minimizers. Warnings, errors and extracted -comments from all minimizers are merged together. +If an array of functions is passed to the `minify` option, each asset is +dispatched to the minimizers whose `filter` accepts it. When more than one +minimizer accepts the same asset the output of each is fed as input to the +next one (the chain semantic). The `minimizerOptions` option can be either an +array of option objects (index-paired with `minify`) or a single object that +will be shared by all minimizers. Warnings, errors and extracted comments +from all running minimizers are merged together. **webpack.config.js** @@ -407,6 +444,31 @@ module.exports = { }; ``` +A single plugin instance can also handle multiple asset types — the built-in +minimizers each ship with a `filter` matching their natural extension, so JS, +CSS, HTML and JSON can all be minified by one shared worker pool: + +```js +module.exports = { + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + // `test` still defaults to JS only, so widen it to catch every + // asset type you want the dispatcher to consider. + test: /\.(?:[cm]?js|css|html?|json)(\?.*)?$/i, + minify: [ + TerserPlugin.terserMinify, + TerserPlugin.cssnanoMinify, + TerserPlugin.htmlMinifierTerser, + TerserPlugin.jsonMinify, + ], + }), + ], + }, +}; +``` + ### `minimizerOptions` Type: diff --git a/package-lock.json b/package-lock.json index 188a27b..bbe7c35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18820,9 +18820,9 @@ } }, "node_modules/terser": { - "version": "5.46.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.46.2.tgz", - "integrity": "sha512-uxfo9fPcSgLDYob/w1FuL0c99MWiJDnv+5qXSQc5+Ki5NjVNsYi66INnMFBjf6uFz6OnX12piJQPF4IpjJTNTw==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.47.1.tgz", + "integrity": "sha512-tPbLXTI6ohPASb/1YViL428oEHu6/qv1OxqYnfaonVCFHqx4+wCd95pHrQWsL5X4pl90CTyW9piSAsS2L0VoMw==", "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", diff --git a/src/index.js b/src/index.js index 64a7e09..8a16685 100644 --- a/src/index.js +++ b/src/index.js @@ -124,6 +124,7 @@ const { * @property {() => string | undefined=} getMinimizerVersion function that returns version of minimizer * @property {() => boolean | undefined=} supportsWorkerThreads true when minimizer support worker threads, otherwise false * @property {() => boolean | undefined=} supportsWorker true when minimizer support worker, otherwise false + * @property {(name: string, info?: AssetInfo) => boolean | undefined=} filter return true when the minimizer supports the asset, otherwise false. When an array of minimizers is configured, each asset is dispatched only to the minimizers whose `filter` accepts it. Assets rejected by every minimizer in the array are skipped entirely. */ /** @@ -377,6 +378,43 @@ class TerserPlugin { async optimize(compiler, compilation, assets, optimizeOptions) { const cache = compilation.getCache("TerserWebpackPlugin"); let numberOfAssets = 0; + + // Normalize the implementation list to an array so dispatch and the + // worker-pool capability checks below can iterate uniformly. The + // original shape on `this.options.minimizer.implementation` is preserved + // for chunk hashing. + const implementations = Array.isArray(this.options.minimizer.implementation) + ? this.options.minimizer.implementation + : [this.options.minimizer.implementation]; + + /** + * Collect the indices of minimizers whose `filter` accepts `name`. + * Filters returning `undefined` are treated as accept (matches the + * convention used by `supportsWorkerThreads`). + * @param {string} name asset name + * @param {AssetInfo} info asset info + * @returns {number[]} indices into `implementations` that accept the asset + */ + const matchingMinimizers = (name, info) => { + const matched = []; + + for (let i = 0; i < implementations.length; i++) { + const impl = implementations[i]; + + if ( + typeof impl.filter !== "function" || + // eslint-disable-next-line unicorn/no-array-method-this-argument + impl.filter(name, info) !== false + ) { + matched.push(i); + } + } + + return matched; + }; + /** @type {Map} */ + const matchedByName = new Map(); + const assetsForMinify = await Promise.all( Object.keys(assets) .filter((name) => { @@ -400,6 +438,16 @@ class TerserPlugin { return false; } + // Compute the matching minimizers once and carry the result to the + // per-asset task via `matchedByName` so the regexes don't run again. + const matched = matchingMinimizers(name, info); + + if (matched.length === 0) { + return false; + } + + matchedByName.set(name, matched); + return true; }) .map(async (name) => { @@ -415,7 +463,14 @@ class TerserPlugin { numberOfAssets += 1; } - return { name, info, inputSource: source, output, cacheItem }; + return { + name, + info, + inputSource: source, + output, + cacheItem, + matched: /** @type {number[]} */ (matchedByName.get(name)), + }; }), ); @@ -430,10 +485,6 @@ class TerserPlugin { /** @type {undefined | number} */ let numberOfWorkers; - const implementations = Array.isArray(this.options.minimizer.implementation) - ? this.options.minimizer.implementation - : [this.options.minimizer.implementation]; - const needCreateWorker = optimizeOptions.availableNumberOfCores > 0 && implementations.every( @@ -496,7 +547,7 @@ class TerserPlugin { for (const asset of assetsForMinify) { scheduledTasks.push(async () => { - const { name, inputSource, info, cacheItem } = asset; + const { name, inputSource, info, cacheItem, matched } = asset; let { output } = asset; if (!output) { @@ -523,11 +574,23 @@ class TerserPlugin { input = input.toString(); } - const clonedMinimizerOptions = Array.isArray( - this.options.minimizer.options, - ) - ? this.options.minimizer.options.map((item) => ({ ...item })) - : { .../** @type {T} */ (this.options.minimizer.options) }; + // Dispatch to only the minimizers whose `filter` accepted this + // asset (computed once when collecting `assetsForMinify`). + // `minify.js` already normalizes a single implementation into a + // one-element array, so we always hand it the matching subset. + // Options are sliced as references — `minify.js` overlays + // `module`/`ecma` without mutating the caller's object. + const assetImplementation = + /** @type {MinimizerImplementation} */ + (matched.map((i) => implementations[i])); + const sourceOptions = this.options.minimizer.options; + const assetMinimizerOptions = + /** @type {MinimizerOptions} */ + ( + Array.isArray(sourceOptions) + ? matched.map((i) => sourceOptions[i] || {}) + : sourceOptions + ); /** * @type {InternalOptions} @@ -537,10 +600,8 @@ class TerserPlugin { input, inputSourceMap, minimizer: { - implementation: this.options.minimizer.implementation, - options: - /** @type {MinimizerOptions} */ - (clonedMinimizerOptions), + implementation: assetImplementation, + options: assetMinimizerOptions, }, extractComments: this.options.extractComments, }; diff --git a/src/minify.js b/src/minify.js index c2bb298..fab6467 100644 --- a/src/minify.js +++ b/src/minify.js @@ -323,8 +323,8 @@ async function minify(options) { const currentImplementation = /** @type {import("./index.js").BasicMinimizerImplementation & import("./index.js").MinimizeFunctionHelpers} */ (implementations[i]); - const currentOptions = - /** @type {import("./index.js").MinimizerOptions} */ + const baseOptions = + /** @type {import("./index.js").MinimizerOptions & { module?: boolean, ecma?: number | string }} */ ( Array.isArray(minimizerOptions) ? minimizerOptions[i] || {} @@ -333,14 +333,15 @@ async function minify(options) { const currentInput = typeof lastCode === "string" ? lastCode : input; const currentMap = typeof lastCode === "string" ? lastMap : inputSourceMap; - /** @type {MinimizerOptions} */ - (currentOptions).module = - /** @type {MinimizerOptions} */ - (currentOptions).module || module; - /** @type {MinimizerOptions} */ - (currentOptions).ecma = - /** @type {MinimizerOptions} */ - (currentOptions).ecma || ecma; + // Overlay `module` and `ecma` without mutating the caller's options so + // a single options object can be reused safely across assets. + const currentOptions = + /** @type {import("./index.js").MinimizerOptions} */ + ({ + ...baseOptions, + module: baseOptions.module || module, + ecma: baseOptions.ecma || ecma, + }); const result = await currentImplementation( { [name]: currentInput }, diff --git a/src/utils.js b/src/utils.js index 86933fc..ea5c035 100644 --- a/src/utils.js +++ b/src/utils.js @@ -11,6 +11,11 @@ * @typedef {string[]} ExtractedComments */ +const JS_FILE_RE = /\.[cm]?js(\?.*)?$/i; +const JSON_FILE_RE = /\.json(\?.*)?$/i; +const HTML_FILE_RE = /\.html?(\?.*)?$/i; +const CSS_FILE_RE = /\.css(\?.*)?$/i; + /** * Map a webpack `output.environment` configuration to the highest * ECMAScript version that the target is known to support. Returns `5` @@ -355,6 +360,12 @@ terserMinify.getMinimizerVersion = () => { */ terserMinify.supportsWorkerThreads = () => true; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ +terserMinify.filter = (name) => JS_FILE_RE.test(name); + /* istanbul ignore next */ /** * @param {Input} input input @@ -586,6 +597,12 @@ uglifyJsMinify.getMinimizerVersion = () => { */ uglifyJsMinify.supportsWorkerThreads = () => true; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ +uglifyJsMinify.filter = (name) => JS_FILE_RE.test(name); + /* istanbul ignore next */ /** * @param {Input} input input @@ -817,6 +834,12 @@ swcMinify.getMinimizerVersion = () => { */ swcMinify.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ +swcMinify.filter = (name) => JS_FILE_RE.test(name); + /* istanbul ignore next */ /** * @param {Input} input input @@ -932,6 +955,12 @@ esbuildMinify.getMinimizerVersion = () => { */ esbuildMinify.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ +esbuildMinify.filter = (name) => JS_FILE_RE.test(name); + /* istanbul ignore next */ /** * @param {Input} input input @@ -958,6 +987,12 @@ jsonMinify.getMinimizerVersion = () => "1.0.0"; jsonMinify.supportsWorker = () => false; jsonMinify.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JSON file + */ +jsonMinify.filter = (name) => JSON_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify HTML using `html-minifier-terser`. @@ -1024,6 +1059,12 @@ htmlMinifierTerser.getMinimizerVersion = () => { */ htmlMinifierTerser.supportsWorkerThreads = () => true; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ +htmlMinifierTerser.filter = (name) => HTML_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify HTML using `@minify-html/node`. @@ -1071,6 +1112,12 @@ minifyHtmlNode.getMinimizerVersion = () => { */ minifyHtmlNode.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ +minifyHtmlNode.filter = (name) => HTML_FILE_RE.test(name); + /* istanbul ignore next */ /** * Map an `@swc/html` diagnostic to a regular `Error`. @@ -1141,6 +1188,12 @@ swcMinifyHtml.getMinimizerVersion = () => { */ swcMinifyHtml.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ +swcMinifyHtml.filter = (name) => HTML_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify an HTML fragment using `@swc/html`. @@ -1195,6 +1248,12 @@ swcMinifyHtmlFragment.getMinimizerVersion = () => { */ swcMinifyHtmlFragment.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ +swcMinifyHtmlFragment.filter = (name) => HTML_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify CSS using `cssnano` (via `postcss`). @@ -1341,6 +1400,12 @@ cssnanoMinify.getMinimizerVersion = () => { */ cssnanoMinify.supportsWorkerThreads = () => true; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ +cssnanoMinify.filter = (name) => CSS_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify CSS using `csso`. @@ -1395,6 +1460,12 @@ cssoMinify.getMinimizerVersion = () => { */ cssoMinify.supportsWorkerThreads = () => true; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ +cssoMinify.filter = (name) => CSS_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify CSS using `clean-css`. @@ -1467,6 +1538,12 @@ cleanCssMinify.getMinimizerVersion = () => { */ cleanCssMinify.supportsWorkerThreads = () => true; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ +cleanCssMinify.filter = (name) => CSS_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify CSS using `esbuild` (with the CSS loader). @@ -1582,6 +1659,12 @@ esbuildMinifyCss.getMinimizerVersion = () => { */ esbuildMinifyCss.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ +esbuildMinifyCss.filter = (name) => CSS_FILE_RE.test(name); + /* istanbul ignore next */ /** * Minify CSS using `lightningcss`. @@ -1651,6 +1734,12 @@ lightningCssMinify.getMinimizerVersion = () => { */ lightningCssMinify.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ +lightningCssMinify.filter = (name) => CSS_FILE_RE.test(name); + /* istanbul ignore next */ /** * Map a `@swc/css` diagnostic to a regular `Error`. @@ -1735,6 +1824,12 @@ swcMinifyCss.getMinimizerVersion = () => { */ swcMinifyCss.supportsWorkerThreads = () => false; +/** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ +swcMinifyCss.filter = (name) => CSS_FILE_RE.test(name); + /** * @template T * @typedef {() => T} FunctionReturning diff --git a/test/__snapshots__/TerserPlugin.test.js.snap b/test/__snapshots__/TerserPlugin.test.js.snap index 5da5302..8fd0f40 100644 --- a/test/__snapshots__/TerserPlugin.test.js.snap +++ b/test/__snapshots__/TerserPlugin.test.js.snap @@ -58,7 +58,7 @@ exports[`TerserPlugin should emit an error on a broken code in parallel mode: wa exports[`TerserPlugin should regenerate hash: assets 1`] = ` Object { "389.389.0217a88dbfe5de109e59.js": "\\"use strict\\";(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[389],{389(e,s,p){p.r(s),p.d(s,{default:()=>c});const c=\\"async-dep\\"}}]);", - "AsyncImportExport.86388917ed5e520d8bf6.js": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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+\\".0217a88dbfe5de109e59.js\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", + "AsyncImportExport.59fa0f8610c254ee3627.js": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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+\\".0217a88dbfe5de109e59.js\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var c,l;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{c.onerror=c.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=d.bind(null,c.onerror),c.onload=d.bind(null,c.onload),l&&document.head.appendChild(c)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),c=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;c.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",c.name=\\"ChunkLoadError\\",c.type=a,c.request=i,o[1](c)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,c,l]=t,u=0;if(i.some(r=>0!==e[r])){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(l)l(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", "importExport.99516598f0f48417cbb9.js": "(()=>{\\"use strict\\";function o(){const o=\`baz\${Math.random()}\`;return()=>({a:\\"foobar\\"+o,b:\\"foo\\",baz:o})}console.log(o())})();", "js.e6d921fb046a3426b75b.js": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", "mjs.46bcd65d7e1972401425.js": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", @@ -140,8 +140,8 @@ exports[`TerserPlugin should work and do not use memory cache when the "cache" o exports[`TerserPlugin should work and generate real content hash: assets 1`] = ` Object { - "389.0217a88dbfe5de109e59.ce6ed80c24bae7bf314e.818a0f6b89f90f0869f1.js": "\\"use strict\\";(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[389],{389(e,s,p){p.r(s),p.d(s,{default:()=>c});const c=\\"async-dep\\"}}]);", - "app.84b993f5eae54cc91298.0b534e1f361c3876ed7c.818a0f6b89f90f0869f1.js": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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+\\".0217a88dbfe5de109e59.ce6ed80c24bae7bf314e.\\"+n.h()+\\".js\\",n.h=()=>\\"818a0f6b89f90f0869f1\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var c,l;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{c.onerror=c.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=d.bind(null,c.onerror),c.onload=d.bind(null,c.onload),l&&document.head.appendChild(c)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={524: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),c=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;c.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",c.name=\\"ChunkLoadError\\",c.type=a,c.request=i,o[1](c)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,c,l]=t,u=0;if(i.some(r=>0!==e[r])){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(l)l(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", + "389.0217a88dbfe5de109e59.b2a2af0d3cf31489a500.08d0e4db29e9469898ae.js": "\\"use strict\\";(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[389],{389(e,s,p){p.r(s),p.d(s,{default:()=>c});const c=\\"async-dep\\"}}]);", + "app.6c8a1cae85a224935d60.946a9b3a6a244597bf93.08d0e4db29e9469898ae.js": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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+\\".0217a88dbfe5de109e59.b2a2af0d3cf31489a500.\\"+n.h()+\\".js\\",n.h=()=>\\"08d0e4db29e9469898ae\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var c,l;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{c.onerror=c.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=d.bind(null,c.onerror),c.onload=d.bind(null,c.onload),l&&document.head.appendChild(c)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={524: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),c=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;c.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",c.name=\\"ChunkLoadError\\",c.type=a,c.request=i,o[1](c)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,c,l]=t,u=0;if(i.some(r=>0!==e[r])){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(l)l(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", } `; diff --git a/test/__snapshots__/extractComments-option.test.js.snap b/test/__snapshots__/extractComments-option.test.js.snap index 73bf2c7..f142cd8 100644 --- a/test/__snapshots__/extractComments-option.test.js.snap +++ b/test/__snapshots__/extractComments-option.test.js.snap @@ -4570,10 +4570,10 @@ exports[`extractComments option should match snapshot for a "function" value: wa exports[`extractComments option should match snapshot for comment file when filename is nested: assets 1`] = ` Object { - "nested/directory/203.js?8a13dd8f829eb92cd580": "/*! For license information please see ../../one.js */ + "nested/directory/203.js?feb1c3d9fc68922c4485": "/*! For license information please see ../../one.js */ (self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[203],{203(e){e.exports=Math.random()}}]);", - "nested/directory/one.js?5dd3b3b60013d2b3d41e": "/*! For license information please see ../../one.js */ -(()=>{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"nested/directory/\\"+e+\\".js?8a13dd8f829eb92cd580\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"nested/directory/\\"+e+\\".js?feb1c3d9fc68922c4485\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var r={250(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(250)})();", - "filename/one.js.LICENSE.txt?d6977202ed375725f74a": "/*! Legal Comment */ + "filename/one.js.LICENSE.txt?c1b5a0c51e6d7fb1dc7b": "/*! Legal Comment */ /*! Legal Foo */ @@ -5560,9 +5560,9 @@ Object { // @lic ", - "filename/one.js?d6977202ed375725f74a": "/*! For license information please see one.js.LICENSE.txt?d6977202ed375725f74a */ -(()=>{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"chunks/\\"+e+\\".\\"+e+\\".js?8a13dd8f829eb92cd580\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"chunks/\\"+e+\\".\\"+e+\\".js?feb1c3d9fc68922c4485\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var r={35(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(35)})();", - "filename/two.js.LICENSE.txt?f0e2aecdcc89eab49b44": "/** + "filename/two.js.LICENSE.txt?41945d353512df22e788": "/** * Information. * @license MIT */ ", - "filename/two.js?f0e2aecdcc89eab49b44": "/*! For license information please see two.js.LICENSE.txt?f0e2aecdcc89eab49b44 */ + "filename/two.js?41945d353512df22e788": "/*! For license information please see two.js.LICENSE.txt?41945d353512df22e788 */ (()=>{var r={12(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(12)})();", } `; @@ -5594,14 +5594,14 @@ Object { /** @license Copyright 2112 Moon. **/ ", - "chunks/203.203.js?8a13dd8f829eb92cd580": "/*! License information can be found in chunks/203.203.js.LICENSE.txt?query=&filebase=203.203.js */ + "chunks/203.203.js?feb1c3d9fc68922c4485": "/*! License information can be found in chunks/203.203.js.LICENSE.txt?query=&filebase=203.203.js */ (self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[203],{203(e){e.exports=Math.random()}}]);", "filename/four.js.LICENSE.txt?query=&filebase=four.js": "/** * Duplicate comment in difference files. * @license MIT */ ", - "filename/four.js?0f89877a1b2619db055e": "/*! License information can be found in filename/four.js.LICENSE.txt?query=&filebase=four.js */ + "filename/four.js?0c2215c34600f4968cf1": "/*! License information can be found in filename/four.js.LICENSE.txt?query=&filebase=four.js */ (()=>{var r={250(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(250)})();", "filename/one.js.LICENSE.txt?query=&filebase=one.js": "/*! Legal Comment */ @@ -5621,8 +5621,8 @@ Object { // @lic ", - "filename/one.js?d6977202ed375725f74a": "/*! License information can be found in filename/one.js.LICENSE.txt?query=&filebase=one.js */ -(()=>{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"chunks/\\"+e+\\".\\"+e+\\".js?8a13dd8f829eb92cd580\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"chunks/\\"+e+\\".\\"+e+\\".js?feb1c3d9fc68922c4485\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var r={35(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(35)})();", "filename/two.js.LICENSE.txt?query=&filebase=two.js": "/** * Information. * @license MIT */ ", - "filename/two.js?f0e2aecdcc89eab49b44": "/*! License information can be found in filename/two.js.LICENSE.txt?query=&filebase=two.js */ + "filename/two.js?41945d353512df22e788": "/*! License information can be found in filename/two.js.LICENSE.txt?query=&filebase=two.js */ (()=>{var r={12(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(12)})();", } `; @@ -5655,14 +5655,14 @@ Object { /** @license Copyright 2112 Moon. **/ ", - "chunks/203.203.js?8a13dd8f829eb92cd580": "/*! For license information please see 203.203.js.LICENSE.txt */ + "chunks/203.203.js?feb1c3d9fc68922c4485": "/*! For license information please see 203.203.js.LICENSE.txt */ (self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[203],{203(e){e.exports=Math.random()}}]);", "filename/four.js.LICENSE.txt": "/** * Duplicate comment in difference files. * @license MIT */ ", - "filename/four.js?0f89877a1b2619db055e": "/*! For license information please see four.js.LICENSE.txt */ + "filename/four.js?0c2215c34600f4968cf1": "/*! For license information please see four.js.LICENSE.txt */ (()=>{var r={250(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(250)})();", "filename/one.js.LICENSE.txt": "/*! Legal Comment */ @@ -5682,8 +5682,8 @@ Object { // @lic ", - "filename/one.js?d6977202ed375725f74a": "/*! For license information please see one.js.LICENSE.txt */ -(()=>{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"chunks/\\"+e+\\".\\"+e+\\".js?8a13dd8f829eb92cd580\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var e,t,r,o,n={855(e,t,r){r.e(203).then(r.t.bind(r,203,23)),e.exports=Math.random()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if(\\"object\\"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&\\"function\\"==typeof r.then)return r}var n=Object.create(null);i.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&o&&r;(\\"object\\"==typeof c||\\"function\\"==typeof c)&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>\\"chunks/\\"+e+\\".\\"+e+\\".js?feb1c3d9fc68922c4485\\",i.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o=\\"terser-webpack-plugin:\\",i.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var l=document.getElementsByTagName(\\"script\\"),p=0;p{c.onerror=c.onload=null,clearTimeout(d);var n=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),n&&n.forEach(e=>e(o)),t)return t(o)},d=setTimeout(f.bind(null,void 0,{type:\\"timeout\\",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),u&&document.head.appendChild(c)}},i.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+\\"\\");var t=i.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName(\\"script\\");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),i.p=e+\\"../\\"})(),(()=>{var e={101:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=e[t]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(t),c=new Error;i.l(a,r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),a=r&&r.target&&r.target.src;c.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+a+\\")\\",c.name=\\"ChunkLoadError\\",c.type=n,c.request=a,o[1](c)}},\\"chunk-\\"+t,t)}};var t=(t,r)=>{var o,n,[a,c,u]=r,l=0;if(a.some(t=>0!==e[t])){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);if(u)u(i)}for(t&&t(r);l{var r={35(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(35)})();", "filename/two.js.LICENSE.txt": "/** * Information. * @license MIT */ ", - "filename/two.js?f0e2aecdcc89eab49b44": "/*! For license information please see two.js.LICENSE.txt */ + "filename/two.js?41945d353512df22e788": "/*! For license information please see two.js.LICENSE.txt */ (()=>{var r={12(r){r.exports=Math.random()}},t={};(function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports})(12)})();", } `; diff --git a/test/__snapshots__/minify-option.test.js.snap b/test/__snapshots__/minify-option.test.js.snap index 656c070..8a7dc3e 100644 --- a/test/__snapshots__/minify-option.test.js.snap +++ b/test/__snapshots__/minify-option.test.js.snap @@ -77,6 +77,68 @@ The 'extractComments' option for 'swcMinify' only supports booleans, \\"some\\", exports[`minify option should report an error when the \`extractComments\` option for \`swcMinify\` uses a function condition: warnings 1`] = `Array []`; +exports[`minify option should skip assets when every minimizer in the \`minify\` array rejects them via \`filter\`: assets 1`] = ` +Object { + "main.js": "/******/ (() => { // webpackBootstrap +/******/ \\"use strict\\"; +class Point { + constructor(x, y) { + this.x = x; + this.y = y; + } + + static distance(a, b) { + const dx = a.x - b.x; + const dy = a.y - b.y; + + return Math.hypot(dx, dy); + } +} + +console.log('HERE'); + +/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (Point))); + +/******/ })() +;", +} +`; + +exports[`minify option should skip assets when every minimizer in the \`minify\` array rejects them via \`filter\`: errors 1`] = `Array []`; + +exports[`minify option should skip assets when every minimizer in the \`minify\` array rejects them via \`filter\`: warnings 1`] = `Array []`; + +exports[`minify option should skip assets when the only minimizer's \`filter\` returns \`false\`: assets 1`] = ` +Object { + "main.js": "/******/ (() => { // webpackBootstrap +/******/ \\"use strict\\"; +class Point { + constructor(x, y) { + this.x = x; + this.y = y; + } + + static distance(a, b) { + const dx = a.x - b.x; + const dy = a.y - b.y; + + return Math.hypot(dx, dy); + } +} + +console.log('HERE'); + +/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (Point))); + +/******/ })() +;", +} +`; + +exports[`minify option should skip assets when the only minimizer's \`filter\` returns \`false\`: errors 1`] = `Array []`; + +exports[`minify option should skip assets when the only minimizer's \`filter\` returns \`false\`: warnings 1`] = `Array []`; + exports[`minify option should snapshot with extracting comments: assets 1`] = ` Object { "main.js": "/*! For license information please see main.js.LICENSE.txt */ @@ -117,6 +179,37 @@ Error", exports[`minify option should throw an error when an error: warnings 1`] = `Array []`; +exports[`minify option should treat a \`filter\` returning \`undefined\` as accept: assets 1`] = ` +Object { + "main.js": "/* undef-filter *//******/ (() => { // webpackBootstrap +/******/ \\"use strict\\"; +class Point { + constructor(x, y) { + this.x = x; + this.y = y; + } + + static distance(a, b) { + const dx = a.x - b.x; + const dy = a.y - b.y; + + return Math.hypot(dx, dy); + } +} + +console.log('HERE'); + +/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (Point))); + +/******/ })() +;", +} +`; + +exports[`minify option should treat a \`filter\` returning \`undefined\` as accept: errors 1`] = `Array []`; + +exports[`minify option should treat a \`filter\` returning \`undefined\` as accept: warnings 1`] = `Array []`; + exports[`minify option should work using when the \`minify\` option is \`esbuildMinify\` and ECMA modules output: assets 1`] = ` Object { "main.js": "var t={};t.d=(_,e)=>{for(var o in e)t.o(e,o)&&!t.o(_,o)&&Object.defineProperty(_,o,{enumerable:!0,get:e[o]})},t.o=(_,e)=>Object.prototype.hasOwnProperty.call(_,e);var r={};t.d(r,{A:()=>p});const c=4;function a(){console.log(7+c)}a();const p=a,s=r.A;export{s as default}; @@ -895,6 +988,17 @@ exports[`minify option should work when \`minify\` and \`terserOptions\` are bot exports[`minify option should work when \`minify\` and \`terserOptions\` are both arrays: warnings 1`] = `Array []`; +exports[`minify option should work when \`minify\` is an array of functions and dispatches by \`filter\`: assets 1`] = ` +Object { + "1d477fcae4c6c3852830.html": " Hello

Hello, World!

Hello there

", + "main.js": "(()=>{var t={740(t,r,e){\\"use strict\\";t.exports=e.p+\\"1d477fcae4c6c3852830.html\\"}},r={};function e(o){var n=r[o];if(void 0!==n)return n.exports;var c=r[o]={exports:{}};return t[o](c,c.exports,e),c.exports}e.m=t,e.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(t){if(\\"object\\"==typeof window)return window}}(),e.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{var t;e.g.importScripts&&(t=e.g.location+\\"\\");var r=e.g.document;if(!t&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(t=r.currentScript.src),!t)){var o=r.getElementsByTagName(\\"script\\");if(o.length)for(var n=o.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=o[n--].src}if(!t)throw new Error(\\"Automatic publicPath is not supported in this browser\\");t=t.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),e.p=t})(),e.b=\\"undefined\\"!=typeof document&&document.baseURI||self.location.href,console.log(new URL(e(740),e.b))})();", +} +`; + +exports[`minify option should work when \`minify\` is an array of functions and dispatches by \`filter\`: errors 1`] = `Array []`; + +exports[`minify option should work when \`minify\` is an array of functions and dispatches by \`filter\`: warnings 1`] = `Array []`; + exports[`minify option should work when \`minify\` is an array of functions using \`htmlMinifierTerser\`: assets 1`] = ` Object { "1d477fcae4c6c3852830.html": " Hello

Hello, World!

Hello there

", diff --git a/test/__snapshots__/test-option.test.js.snap b/test/__snapshots__/test-option.test.js.snap index 8931093..9c9aabb 100644 --- a/test/__snapshots__/test-option.test.js.snap +++ b/test/__snapshots__/test-option.test.js.snap @@ -2,11 +2,11 @@ exports[`test option should match snapshot and uglify "mjs": assets 1`] = ` Object { - "389.389.mjs?ver=265eb92bce83b7be4c6e": "\\"use strict\\";(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[389],{389(e,s,p){p.r(s),p.d(s,{default:()=>c});const c=\\"async-dep\\"}}]);", - "AsyncImportExport.mjs?var=265eb92bce83b7be4c6e": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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+\\".mjs?ver=\\"+n.h(),n.h=()=>\\"265eb92bce83b7be4c6e\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(b);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},b=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", - "importExport.mjs?var=265eb92bce83b7be4c6e": "(()=>{\\"use strict\\";function o(){const o=\`baz\${Math.random()}\`;return()=>({a:\\"foobar\\"+o,b:\\"foo\\",baz:o})}console.log(o())})();", - "js.mjs?var=265eb92bce83b7be4c6e": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", - "mjs.mjs?var=265eb92bce83b7be4c6e": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", + "389.389.mjs?ver=8cabdf2fe0b1cdf45bee": "\\"use strict\\";(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[389],{389(e,s,p){p.r(s),p.d(s,{default:()=>c});const c=\\"async-dep\\"}}]);", + "AsyncImportExport.mjs?var=8cabdf2fe0b1cdf45bee": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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+\\".mjs?ver=\\"+n.h(),n.h=()=>\\"8cabdf2fe0b1cdf45bee\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", + "importExport.mjs?var=8cabdf2fe0b1cdf45bee": "(()=>{\\"use strict\\";function o(){const o=\`baz\${Math.random()}\`;return()=>({a:\\"foobar\\"+o,b:\\"foo\\",baz:o})}console.log(o())})();", + "js.mjs?var=8cabdf2fe0b1cdf45bee": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", + "mjs.mjs?var=8cabdf2fe0b1cdf45bee": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", } `; @@ -16,7 +16,7 @@ exports[`test option should match snapshot and uglify "mjs": warnings 1`] = `Arr exports[`test option should match snapshot for a single "test" value ({String}): assets 1`] = ` Object { - "389.389.js?ver=d569fb48b799414bf71c": "\\"use strict\\"; + "389.389.js?ver=aa28aebb3049d51e5197": "\\"use strict\\"; (self[\\"webpackChunkterser_webpack_plugin\\"] = self[\\"webpackChunkterser_webpack_plugin\\"] || []).push([[389],{ /***/ 389 @@ -32,7 +32,7 @@ __webpack_require__.r(__webpack_exports__); /***/ } }]);", - "AsyncImportExport.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "AsyncImportExport.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; /******/ var __webpack_modules__ = ({}); /************************************************************************/ @@ -100,7 +100,7 @@ __webpack_require__.r(__webpack_exports__); /******/ /******/ /* webpack/runtime/getFullHash */ /******/ (() => { -/******/ __webpack_require__.h = () => (\\"d569fb48b799414bf71c\\") +/******/ __webpack_require__.h = () => (\\"aa28aebb3049d51e5197\\") /******/ })(); /******/ /******/ /* webpack/runtime/global */ @@ -299,7 +299,7 @@ __webpack_require__.e(/* import() */ 389).then(__webpack_require__.bind(__webpac /******/ })() ;", - "importExport.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "importExport.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; // UNUSED EXPORTS: default @@ -329,8 +329,8 @@ console.log(Foo()); /******/ })() ;", - "js.js?var=d569fb48b799414bf71c": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", - "mjs.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "js.js?var=aa28aebb3049d51e5197": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", + "mjs.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; // foo // bar @@ -356,7 +356,7 @@ exports[`test option should match snapshot for a single "test" value ({String}): exports[`test option should match snapshot for a single \`test\` value ({RegExp}): assets 1`] = ` Object { - "389.389.js?ver=d569fb48b799414bf71c": "\\"use strict\\"; + "389.389.js?ver=aa28aebb3049d51e5197": "\\"use strict\\"; (self[\\"webpackChunkterser_webpack_plugin\\"] = self[\\"webpackChunkterser_webpack_plugin\\"] || []).push([[389],{ /***/ 389 @@ -372,7 +372,7 @@ __webpack_require__.r(__webpack_exports__); /***/ } }]);", - "AsyncImportExport.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "AsyncImportExport.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; /******/ var __webpack_modules__ = ({}); /************************************************************************/ @@ -440,7 +440,7 @@ __webpack_require__.r(__webpack_exports__); /******/ /******/ /* webpack/runtime/getFullHash */ /******/ (() => { -/******/ __webpack_require__.h = () => (\\"d569fb48b799414bf71c\\") +/******/ __webpack_require__.h = () => (\\"aa28aebb3049d51e5197\\") /******/ })(); /******/ /******/ /* webpack/runtime/global */ @@ -639,7 +639,7 @@ __webpack_require__.e(/* import() */ 389).then(__webpack_require__.bind(__webpac /******/ })() ;", - "importExport.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "importExport.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; // UNUSED EXPORTS: default @@ -669,8 +669,8 @@ console.log(Foo()); /******/ })() ;", - "js.js?var=d569fb48b799414bf71c": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", - "mjs.js?var=d569fb48b799414bf71c": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", + "js.js?var=aa28aebb3049d51e5197": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", + "mjs.js?var=aa28aebb3049d51e5197": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", } `; @@ -680,7 +680,7 @@ exports[`test option should match snapshot for a single \`test\` value ({RegExp} exports[`test option should match snapshot for multiple "test" values ({RegExp}): assets 1`] = ` Object { - "389.389.js?ver=d569fb48b799414bf71c": "\\"use strict\\"; + "389.389.js?ver=aa28aebb3049d51e5197": "\\"use strict\\"; (self[\\"webpackChunkterser_webpack_plugin\\"] = self[\\"webpackChunkterser_webpack_plugin\\"] || []).push([[389],{ /***/ 389 @@ -696,8 +696,8 @@ __webpack_require__.r(__webpack_exports__); /***/ } }]);", - "AsyncImportExport.js?var=d569fb48b799414bf71c": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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?ver=\\"+n.h(),n.h=()=>\\"d569fb48b799414bf71c\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", - "importExport.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "AsyncImportExport.js?var=aa28aebb3049d51e5197": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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?ver=\\"+n.h(),n.h=()=>\\"aa28aebb3049d51e5197\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", + "importExport.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; // UNUSED EXPORTS: default @@ -727,8 +727,8 @@ console.log(Foo()); /******/ })() ;", - "js.js?var=d569fb48b799414bf71c": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", - "mjs.js?var=d569fb48b799414bf71c": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", + "js.js?var=aa28aebb3049d51e5197": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", + "mjs.js?var=aa28aebb3049d51e5197": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", } `; @@ -738,7 +738,7 @@ exports[`test option should match snapshot for multiple "test" values ({RegExp}) exports[`test option should match snapshot for multiple "test" values ({String}): assets 1`] = ` Object { - "389.389.js?ver=d569fb48b799414bf71c": "\\"use strict\\"; + "389.389.js?ver=aa28aebb3049d51e5197": "\\"use strict\\"; (self[\\"webpackChunkterser_webpack_plugin\\"] = self[\\"webpackChunkterser_webpack_plugin\\"] || []).push([[389],{ /***/ 389 @@ -754,8 +754,8 @@ __webpack_require__.r(__webpack_exports__); /***/ } }]);", - "AsyncImportExport.js?var=d569fb48b799414bf71c": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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?ver=\\"+n.h(),n.h=()=>\\"d569fb48b799414bf71c\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", - "importExport.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "AsyncImportExport.js?var=aa28aebb3049d51e5197": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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?ver=\\"+n.h(),n.h=()=>\\"aa28aebb3049d51e5197\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", + "importExport.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; // UNUSED EXPORTS: default @@ -785,8 +785,8 @@ console.log(Foo()); /******/ })() ;", - "js.js?var=d569fb48b799414bf71c": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", - "mjs.js?var=d569fb48b799414bf71c": "/******/ (() => { // webpackBootstrap + "js.js?var=aa28aebb3049d51e5197": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", + "mjs.js?var=aa28aebb3049d51e5197": "/******/ (() => { // webpackBootstrap /******/ \\"use strict\\"; // foo // bar @@ -812,11 +812,11 @@ exports[`test option should match snapshot for multiple "test" values ({String}) exports[`test option should match snapshot with empty value: assets 1`] = ` Object { - "389.389.js?ver=d569fb48b799414bf71c": "\\"use strict\\";(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[389],{389(e,s,p){p.r(s),p.d(s,{default:()=>c});const c=\\"async-dep\\"}}]);", - "AsyncImportExport.js?var=d569fb48b799414bf71c": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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?ver=\\"+n.h(),n.h=()=>\\"d569fb48b799414bf71c\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", - "importExport.js?var=d569fb48b799414bf71c": "(()=>{\\"use strict\\";function o(){const o=\`baz\${Math.random()}\`;return()=>({a:\\"foobar\\"+o,b:\\"foo\\",baz:o})}console.log(o())})();", - "js.js?var=d569fb48b799414bf71c": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", - "mjs.js?var=d569fb48b799414bf71c": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", + "389.389.js?ver=aa28aebb3049d51e5197": "\\"use strict\\";(self.webpackChunkterser_webpack_plugin=self.webpackChunkterser_webpack_plugin||[]).push([[389],{389(e,s,p){p.r(s),p.d(s,{default:()=>c});const c=\\"async-dep\\"}}]);", + "AsyncImportExport.js?var=aa28aebb3049d51e5197": "(()=>{\\"use strict\\";var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=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?ver=\\"+n.h(),n.h=()=>\\"aa28aebb3049d51e5197\\",n.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r=\\"terser-webpack-plugin:\\",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==a)for(var u=document.getElementsByTagName(\\"script\\"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:\\"timeout\\",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+\\"\\");var r=n.g.document;if(!e&&r&&(r.currentScript&&\\"SCRIPT\\"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName(\\"script\\");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),n.p=e})(),(()=>{var e={988: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),l=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;l.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+a+\\": \\"+i+\\")\\",l.name=\\"ChunkLoadError\\",l.type=a,l.request=i,o[1](l)}},\\"chunk-\\"+r,r)}};var r=(r,t)=>{var o,a,[i,l,c]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);u{console.log(\\"Good\\")})})();", + "importExport.js?var=aa28aebb3049d51e5197": "(()=>{\\"use strict\\";function o(){const o=\`baz\${Math.random()}\`;return()=>({a:\\"foobar\\"+o,b:\\"foo\\",baz:o})}console.log(o())})();", + "js.js?var=aa28aebb3049d51e5197": "(()=>{var r={921(r){r.exports=function(){console.log(7)}}},o={};(function t(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports})(921)})();", + "mjs.js?var=aa28aebb3049d51e5197": "(()=>{\\"use strict\\";function o(){console.log(11)}o()})();", } `; diff --git a/test/minify-option.test.js b/test/minify-option.test.js index b87dcf1..c4aa9cf 100644 --- a/test/minify-option.test.js +++ b/test/minify-option.test.js @@ -1301,4 +1301,119 @@ describe("minify option", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); expect(getWarnings(stats)).toMatchSnapshot("warnings"); }); + + it("should work when `minify` is an array of functions and dispatches by `filter`", async () => { + const compiler = getCompiler({ + entry: path.resolve(__dirname, "./fixtures/html.js"), + }); + + new TerserPlugin({ + test: /\.(?:[cm]?js|html?)(\?.*)?$/i, + minify: [TerserPlugin.terserMinify, TerserPlugin.htmlMinifierTerser], + }).apply(compiler); + + const stats = await compile(compiler); + + expect(readsAssets(compiler, stats)).toMatchSnapshot("assets"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + }); + + it("should skip assets when the only minimizer's `filter` returns `false`", async () => { + const compiler = getCompiler({ + entry: path.resolve(__dirname, "./fixtures/minify/es6.js"), + output: { + path: path.resolve(__dirname, "./dist-terser"), + filename: "[name].js", + chunkFilename: "[id].[name].js", + }, + }); + + const minify = (file) => { + const [[, code]] = Object.entries(file); + + return { code: `/* minified */${code}` }; + }; + + minify.filter = () => false; + + new TerserPlugin({ + parallel: false, + minify, + }).apply(compiler); + + const stats = await compile(compiler); + + expect(readsAssets(compiler, stats)).toMatchSnapshot("assets"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + }); + + it("should treat a `filter` returning `undefined` as accept", async () => { + const compiler = getCompiler({ + entry: path.resolve(__dirname, "./fixtures/minify/es6.js"), + output: { + path: path.resolve(__dirname, "./dist-terser"), + filename: "[name].js", + chunkFilename: "[id].[name].js", + }, + }); + + const minify = (file) => { + const [[, code]] = Object.entries(file); + + return { code: `/* undef-filter */${code}` }; + }; + + minify.filter = () => undefined; + + new TerserPlugin({ + parallel: false, + minify, + }).apply(compiler); + + const stats = await compile(compiler); + + expect(readsAssets(compiler, stats)).toMatchSnapshot("assets"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + }); + + it("should skip assets when every minimizer in the `minify` array rejects them via `filter`", async () => { + const compiler = getCompiler({ + entry: path.resolve(__dirname, "./fixtures/minify/es6.js"), + output: { + path: path.resolve(__dirname, "./dist-terser"), + filename: "[name].js", + chunkFilename: "[id].[name].js", + }, + }); + + const cssOnly = (file) => { + const [[, code]] = Object.entries(file); + + return { code: `/* css */${code}` }; + }; + + cssOnly.filter = (name) => /\.css(\?.*)?$/i.test(name); + + const htmlOnly = (file) => { + const [[, code]] = Object.entries(file); + + return { code: `/* html */${code}` }; + }; + + htmlOnly.filter = (name) => /\.html?(\?.*)?$/i.test(name); + + new TerserPlugin({ + parallel: false, + minify: [cssOnly, htmlOnly], + }).apply(compiler); + + const stats = await compile(compiler); + + expect(readsAssets(compiler, stats)).toMatchSnapshot("assets"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + }); }); diff --git a/types/index.d.ts b/types/index.d.ts index 6ccffd7..f076566 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -249,6 +249,12 @@ type MinimizeFunctionHelpers = { * true when minimizer support worker, otherwise false */ supportsWorker?: (() => boolean | undefined) | undefined; + /** + * return true when the minimizer supports the asset, otherwise false. When an array of minimizers is configured, each asset is dispatched only to the minimizers whose `filter` accepts it. Assets rejected by every minimizer in the array are skipped entirely. + */ + filter?: + | ((name: string, info?: AssetInfo) => boolean | undefined) + | undefined; }; type MinimizerImplementation = T extends EXPECTED_ANY[] ? { diff --git a/types/utils.d.ts b/types/utils.d.ts index 8979e94..0f1e50e 100644 --- a/types/utils.d.ts +++ b/types/utils.d.ts @@ -1,3 +1,5 @@ +export type Task = () => Promise; +export type FunctionReturning = () => T; export type ExtractCommentsOptions = import("./index.js").ExtractCommentsOptions; export type ExtractCommentsFunction = @@ -10,8 +12,6 @@ export type CustomOptions = import("./index.js").CustomOptions; export type RawSourceMap = import("./index.js").RawSourceMap; export type EXPECTED_OBJECT = import("./index.js").EXPECTED_OBJECT; export type ExtractedComments = string[]; -export type Task = () => Promise; -export type FunctionReturning = () => T; /** * Minify CSS using `clean-css`. * @param {Input} input input @@ -33,6 +33,11 @@ export namespace cleanCssMinify { * @returns {boolean | undefined} true if worker threads are supported */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ + function filter(name: string): boolean; } /** * Minify CSS using `cssnano` (via `postcss`). @@ -55,6 +60,11 @@ export namespace cssnanoMinify { * @returns {boolean | undefined} true if worker threads are supported */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ + function filter(name: string): boolean; } /** * Minify CSS using `csso`. @@ -77,6 +87,11 @@ export namespace cssoMinify { * @returns {boolean | undefined} true if worker threads are supported */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ + function filter(name: string): boolean; } /** * @param {Input} input input @@ -98,6 +113,11 @@ export namespace esbuildMinify { * @returns {boolean | undefined} true if worker thread is supported, false otherwise */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ + function filter(name: string): boolean; } /** * Minify CSS using `esbuild` (with the CSS loader). @@ -120,18 +140,12 @@ export namespace esbuildMinifyCss { * @returns {boolean | undefined} false because `esbuild` is a native binding */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ + function filter(name: string): boolean; } -/** @typedef {import("./index.js").ExtractCommentsOptions} ExtractCommentsOptions */ -/** @typedef {import("./index.js").ExtractCommentsFunction} ExtractCommentsFunction */ -/** @typedef {import("./index.js").ExtractCommentsCondition} ExtractCommentsCondition */ -/** @typedef {import("./index.js").Input} Input */ -/** @typedef {import("./index.js").MinimizedResult} MinimizedResult */ -/** @typedef {import("./index.js").CustomOptions} CustomOptions */ -/** @typedef {import("./index.js").RawSourceMap} RawSourceMap */ -/** @typedef {import("./index.js").EXPECTED_OBJECT} EXPECTED_OBJECT */ -/** - * @typedef {string[]} ExtractedComments - */ /** * Map a webpack `output.environment` configuration to the highest * ECMAScript version that the target is known to support. Returns `5` @@ -165,6 +179,11 @@ export namespace htmlMinifierTerser { * @returns {boolean | undefined} true if worker threads are supported */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ + function filter(name: string): boolean; } /** * @param {Input} input input @@ -181,6 +200,11 @@ export namespace jsonMinify { function getMinimizerVersion(): string; function supportsWorker(): boolean; function supportsWorkerThreads(): boolean; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JSON file + */ + function filter(name: string): boolean; } /** * Minify CSS using `lightningcss`. @@ -203,6 +227,11 @@ export namespace lightningCssMinify { * @returns {boolean | undefined} false because `lightningcss` is a native binding */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ + function filter(name: string): boolean; } /** * @template T @@ -235,6 +264,11 @@ export namespace minifyHtmlNode { * @returns {boolean | undefined} false because `@minify-html/node` is a native binding */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ + function filter(name: string): boolean; } /** * @param {Input} input input @@ -258,6 +292,11 @@ export namespace swcMinify { * @returns {boolean | undefined} true if worker thread is supported, false otherwise */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ + function filter(name: string): boolean; } /** * Minify CSS using `@swc/css`. @@ -280,6 +319,11 @@ export namespace swcMinifyCss { * @returns {boolean | undefined} false because `@swc/css` is a native binding */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a CSS file + */ + function filter(name: string): boolean; } /** * Minify a complete HTML document using `@swc/html`. @@ -302,6 +346,11 @@ export namespace swcMinifyHtml { * @returns {boolean | undefined} false because `@swc/html` is a native binding */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ + function filter(name: string): boolean; } /** * Minify an HTML fragment using `@swc/html`. @@ -327,6 +376,11 @@ export namespace swcMinifyHtmlFragment { * @returns {boolean | undefined} false because `@swc/html` is a native binding */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like an HTML file + */ + function filter(name: string): boolean; } /** * @param {Input} input input @@ -350,6 +404,11 @@ export namespace terserMinify { * @returns {boolean | undefined} true if worker thread is supported, false otherwise */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ + function filter(name: string): boolean; } /** * @template T @@ -385,4 +444,9 @@ export namespace uglifyJsMinify { * @returns {boolean | undefined} true if worker thread is supported, false otherwise */ function supportsWorkerThreads(): boolean | undefined; + /** + * @param {string} name asset name + * @returns {boolean} true if `name` looks like a JavaScript file + */ + function filter(name: string): boolean; }